Click here to Skip to main content
11,635,123 members (77,531 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET
Hi, Please any one help on this issue..Thank you for your help in advance,
Posted 16-Nov-11 18:46pm
Comments
AmolPandurangBorkar at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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>

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>


protected void LinkButton1_Click(object sender, EventArgs e)
       {
        //your code goes here 
      }
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

HyperLink does not have a click event.

If you want click event you can use LinkButton.
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 8,736
1 Sergey Alexandrovich Kryukov 8,419
2 Mika Wendelius 6,845
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,205


Advertise | Privacy | Mobile
Web03 | 2.8.150728.1 | Last Updated 17 Nov 2011
Copyright © CodeProject, 1999-2015
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