ModalPopupExtender Problem

  • Thread starter Thread starter GaryDean
  • Start date Start date
G

GaryDean

After watching the video on the ModalPopupExtender from MSDN I designed a
panel with some controls on it: A dropdown box, an ok button, a cancel
button. Unfortunitely, the video only shows how to trigger client side
javascript and not server side events(Grrrrrr). I supposed that I simply
have to handle events from the controls on the panel.

Well, when I change values in the dropdown, or push the buttons on the
panel, the server side events do indeed trigger but the modal box goes
away!! how can I keep it displayed until it is dismissed by, say, a button
identified by the ModalPopupExtender OkControlId entry.

The general idea here is that I want to have somewhat of a complex form on
this panel with all sorts of controls. is this possible?
Thanks,
Gary
 
Allen:
On this forum I almost always get an excellent answer. The other forum is
not so good. It's kind of "pot luck" over there but it is a specialty forum
on just ajax so I thought I would post there also.

I've gotten a resonse over there saying there are issues with the
ModalPopupExtender when used in concert with an updatepanel however I
completely removed the update panel and the popup form still disappears upon
postback. I also notice the the video on msdn conveniently avoided the
postback issue.

I think the problem is that it just doesn't work.

It would be nice to be able to take issue to the point where I either got a
solution or an admission that it just does not work.
Gary
 
Hi Gary,

Thanks for your update. As Bruce said in that post, we need to do async
postback.

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?&query=Mo
dalPopupExtender&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.dotnet.f
ramework.aspnet&p=1&tid=0f1ca747-8cf6-4ae4-a606-5804d6a2d0cf

ModalPopupExtender itself cannot achieve your requirement.

I've sent a post there that demonstrates how to do this. I'd like to
repost it here:

aspx:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Label ID="Label2" runat="server" Text="Click Me to Show Popup
Window!" BackColor="Yellow"></asp:Label>
<cc1:ModalPopupExtender ID="Label2_ModalPopupExtender"
runat="server"
TargetControlID="Label2"
OkControlID="Button3" DropShadow="true"
PopupControlID="Panel1">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" BackColor="Pink" runat="server"
style="display:none;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button2" runat="server" Text="Click Me"
onclick="Button2_Click" />
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />

</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button3" runat="server" Text="OK" />

</asp:Panel>

aspx.cs:

protected void Button2_Click(object sender, EventArgs e)
{
this.Label1.Text = DateTime.Now.ToString();
}


Could you test it first to see if it's what you need? For further
discussion please update in that post. I'll try my best to follow up.

Regards,
Allen Chen
Microsoft Online Community Support
 
Back
Top