Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, Please any one help on this issue..Thank you for your help in advance,
Posted
Comments
Amol_27101982, India 17-Nov-11 0:56am    
I think you need to improve your question.
What exactly you want is not clear...
Whatever source given for the hyperlink, that will get executed.

hyperlink does not have a click event. You can use javascript hyperlink.

http://www.webmasterworld.com/javascript/3271334.htm[^]
http://snippets.dzone.com/posts/show/1720[^]
 
Share this answer
 
According to my understanding you need to fire click event on Hyper Link where the event is not originally embedded with the control.

for do so you can use
<asp:HyperLink ID="HyperLink1" runat="server" onload="HyperLink1_Load">HyperLink</asp:HyperLink>


C#
protected void HyperLink1_Load(object sender, EventArgs e)
       {
           HyperLink1.Attributes.Add("onclick",
          "javascript:alert('ALERT ALERT!!!')");
       }

by registering new onclick event. but when ever click on the hyper link it will fire javascript function. so you can write logic inside the javascript function.

For me,i think there is alternative that you can use instead of Hyperlink.
Use Link Button. It looks exact like Hyper Link and you can fire server side Click event from the control it self.

<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">LinkButton</asp:LinkButton>


C#
protected void LinkButton1_Click(object sender, EventArgs e)
       {
        //your code goes here 
      }
 
Share this answer
 
HyperLink does not have a click event.

If you want click event you can use LinkButton.
 
Share this answer
 
v2

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