Thursday, April 28, 2011

Ajax Modal Popup Extender

Problem/Challenge:
Call on a Modal Popup represented in the Master Page's code behind from a content page in order to display the Magic 8 Ball project I created using the techniques from week 2 fundamentals of C# at Centriq. To do this I originally just re-created the entire project on the Project page. However I did not like having such a large amount of duplicate code.

Solution:
Using the Master Find Control Method allows full use of any control on the master page on all content pages with full functionality.

protected void magic8BallMPE_Click( object sender, EventArgs e) 
{ 
   ModalPopupExtender mpe8Ball = 
          Master .FindControl("mpe8Ball") as ModalPopupExtender;
   mpe8Ball.Show(); 
}


No comments:

Post a Comment