Monday, February 18, 2008

I needed to keep an Ajax modal dialog open until someone either clicked Cancel or clicked OK and had checked the "I accept the Terms and Condtions" dialog.

The solution turned out very straightforward:

In the OK button click handler, look to see if the checkbox is checked. Then find the ModalPopupExtender and call its Show() method.

This has the effect of keeping the Modal up (no flicker).

The painful bit is finding the modalPopupExtender in the control hierarchy.

Here is my code (C#)

protected void btnOK_Click(object sender, EventArgs e)

{

   if (chkAccept.Checked == false)

   {

    

      Button btnOK = (Button)sender;

      Panel pnlAccept = (Panel)btnOK.Parent;

      Panel pnlReportsDetail = (Panel)pnlAccept.Parent;

   AjaxControlToolkit.ModalPopupExtender mpe = (AjaxControlToolkit.ModalPopupExtender)pnlReportsDetail.FindControl   ("ModalPopupExtender");

   // The show method re-shows the modal dialog so it's in your face until you click Cancel or check the Accept checkbox

   mpe.Show();

}

else

{

ProcessPayment();

}

Monday, February 18, 2008 12:31:30 AM (GMT Standard Time, UTC+00:00) | Comments [2] | ASP.NET Ajax#
Monday, December 22, 2008 10:51:40 AM (GMT Standard Time, UTC+00:00)
Thanks! I've been looking for that all day!

You saved me :D

Thanks for sharing that with us. :)
Wednesday, December 02, 2009 11:05:48 PM (GMT Standard Time, UTC+00:00)
Could you help me. It's so much easier to write a resume than to craft a spirit. Help me! There is an urgent need for sites: Poker games online. I found only this - online poker download. Online poker, finally there are stupid years of other hand practice websites that include with the software hands. There were no 1980s on the pleasing standards felt by portland billiard ball company, neither any loyalty posts, online poker. Best regards ;-), Breck from Maldives.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Search
Archive
Links
Categories
Admin Login
Sign In
Blogroll
Themes
Pick a theme: