ModalPopupExtender

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I am trying to use ASP.NET Ajax Control Toolkit ModalPopupExtender which
works fine, but what I am trying to do is:

1) User Clicks on the button:
2) Function on the server will check for a status
3) Only display ModalPopupExtender if the status is True.

How do I do that, how do I display ModalPopupExtender only after postback?
Is that possible?


Thank You


Peter
 
Hi Peter,
Is it what you need?

Aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
this.ModalPopupExtender1.Enabled = false;
}

protected void Button1_Click(object sender, EventArgs e)
{
if (true)//condition here
{
this.ModalPopupExtender1.Enabled = true;
}
}

Aspx:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

<asp:Label ID="Label1" runat="server" Text="Click Me After
ModalPopupExtender is Enabled" BackColor="Yellow"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Enable
ModalPopupExtender" onclick="Button1_Click" />
<asp:Panel ID="Panel1" runat="server" style="display:none" >
Hello</asp:Panel>
<cc1:ModalPopupExtender ID="ModalPopupExtender1"
runat="server" PopupControlID="Panel1" TargetControlID="Label1" >
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>

Please have a try and let me know if it works. If it's not what you need
please clarify your requirement.

Regards,
Allen Chen
Microsoft Online 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.
 
Hi Peter,

Does my code work?

Regards,
Allen Chen
Microsoft Online Community Support
 
Back
Top