Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET Ajax
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 4-Aug-12 3:01am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I think you have not heard of Google Search engine
 
In the Hyperlink1_Click event in code-behind use this code
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..
  Permalink  
v3
Comments
_Amy at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try this:
ModalPopupExtender ModalPopupExtender1 = new ModalPopupExtender();
ModalPopupExtender1.TargetControlID = Hyperlink1.ClientID; 
// Here you can set directly ID also.
//Now show your Model Popup.
ModalPopupExtender1.Show();
 

--Amit
  Permalink  

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



Advertise | Privacy | Mobile
Web01 | 2.8.141022.1 | Last Updated 4 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100