Writing onclick event for button

Discussion in 'ASP .Net' started by Sandeep, May 20, 2004.

  1. Sandeep

    Sandeep Guest

    Hi

    I want to write onclick event on a button(a web control) ,also i want to
    call a client side function on the click event
    how to write that how to differentiate between these two events

    Will it be like that
    <asp:button id="ss" onclick="javascript:ss()" onserverclick="btn_click()">



    Regards

    Sandeep
     
    Sandeep, May 20, 2004
    #1
    1. Advertising

  2. Sandeep

    Teemu Keiski Guest

    You'd do it in code (because normal ASP.NET Button the event handler is
    named as OnClick for server.side click event handler.

    Example:
    Button1.Attributes("onclick") = "alert('This is raised before postback')"

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke


    "Sandeep" <> wrote in message
    news:%...
    > Hi
    >
    > I want to write onclick event on a button(a web control) ,also i want to
    > call a client side function on the click event
    > how to write that how to differentiate between these two events
    >
    > Will it be like that
    > <asp:button id="ss" onclick="javascript:ss()" onserverclick="btn_click()">
    >
    >
    >
    > Regards
    >
    > Sandeep
    >
    >
    >
     
    Teemu Keiski, May 20, 2004
    #2
    1. Advertising

  3. hi

    You can achieve this task by writing ClientScriptBlock

    Regards
    Sathesh
     
    =?Utf-8?B?U2F0aGVzaCBBcnVtdWdhbQ==?=, May 21, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page