Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Code Project Members

I want to open Ajax Model PopUp on HyperLink's click. My HyperLink is on MasterPage & PopUp is on normal page. Please help me to achieve this.
Posted

I think you have not heard of Google Search engine

In the Hyperlink1_Click event in code-behind use this code
C#
ModalPopupExtender1.TargetControlID=(this.MasterPage.FindControl("Hyperlink1") as HyperLink).ID;
ModalPopupExtender1.Show();


http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ModalPopup/ModalPopup.aspx[^]

http://www.dotnetcurry.com/ShowArticle.aspx?ID=285[^]

ASP.NET AJAX Control Toolkit ModalPopupExtender Control in Action[^]

http://csharpdotnetfreak.blogspot.com/2011/03/ajax-modalpopupextender-example-aspnet.html[^]

The additional information for you is that ModalPopup can be opened with Button, ImageButton or Hyperlink and other similar controls..
 
Share this answer
 
v3
Comments
_Amy 4-Aug-12 11:15am    
I am sorry but my vote of 2, because you did a mistake while reading the question. Hyperlink1_Click event will be fired on master page itself and you are finding the hyperlink again in from the master page. You should find ModalPopupExtender1 and set the TargetControlID.
Try this:
C#
ModalPopupExtender ModalPopupExtender1 = new ModalPopupExtender();
ModalPopupExtender1.TargetControlID = Hyperlink1.ClientID; 
// Here you can set directly ID also.
//Now show your Model Popup.
ModalPopupExtender1.Show();



--Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900