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

    Href onclick event with StringBuilder in c#

    how to write the href onclick event with string builder in C#

    sbNews.Append("<a href=\'" + rdr[2].ToString() + "'\" onclick=\"openNewWin()\" >Click here to view more</a>");

    how to write the href onclick event for the above href

    please help me
  • #763732
    You have write a Anchor tag and give 'href' attribute in tag itself, so there is no need to fire onclick event and in fact you can not fire onclick event for anchor tag
    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #763753
    Hi rao,

    Could you please elaborate your requirement clearly?

    basically href we are used to redirect to another page using anchor tags. the property href will help us to mentioned the redirected URL for the same, then what purpose you are using OnClick event for anchor tags. Please elaborate it, so that we can help you better.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #763757
    you can not handling onclick and href for same "A" tag.

    if you want to check any validation before redirection
    you can write the javascript. In the javascript function you can check the validation

    href="javascript:alert('Hello World!');

    By Nathan
    Direction is important than speed


Sign In to post your comments