ModalPopupExtender

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
 
B

bruce barker

the ModalPopupExtender is only a javascript visual effect (unhides a div). if
you do a postback in it it postbacks. you make serverside call with the
client ajax library. if you can not code javascript, you can also put an
update panel inside the popup panel, and do an async postback.

-- bruce (sqlwork.com)
 
A

Allen Chen [MSFT]

Hi Gary,

What Bruce said is reasonable. Here's the code that demonstrates how to do
this:

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();
}

The basic idea is to use UpdatePanel to do async postback.

If you have further questions please feel free to ask.

Regards,
Allen Chen
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Allen Chen [MSFT]

Hi Gary,

Do you have any progress on this issue?

Regards,
Allen Chen
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top