You must Sign In to post a response.
  • Category: .NET

    How to call html hyperlink click method in c# .net

    Hi All,


    Below CallingMethod() need to define in c#. is it possible?
    not in javascipt.


    <html>

    <head>


    </head>
    <body>




    <a href="" onclick="CallingMethod(); return false;">Click </a>

    </body>
    </html>
  • #769862
    Hi Urmila,

    You can refer below code.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <a title="" runat="server" onserverclick="Anchor_Click" target="_blank" href="https://www.google.com">Click Me!</a>
    </div>
    </form>
    </body>
    </html>

    protected void Anchor_Click(object sender, EventArgs e)
    {
    Response.Write("You clicked on hyperlink.");
    }

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

    Delete Attachment


  • Sign In to post your comments