What is the difference between OnClick and OnServerClick in web button control

Discussion in 'ASP .Net' started by Krishna, Nov 22, 2003.

  1. Krishna

    Krishna Guest

    1. What is the difference between OnClick and
    OnServerClick in web button control

    If I have a asp button control as follows

    <asp:button id="SubmitOrder" Text="Submit Order"
    OnClick="OnSubmit_Click()" runat="server" >
    </asp:button>

    If the above is going to fire server side function what is
    the difference between
    OnClick and OnServerClick

    2. I have function OnVerifySubmit_Click() which I would
    like to run before
    posting page to server

    What is the correct way

    <asp:button id="SubmitOrder" Text="Submit Order"
    OnClick="OnVerifySubmit_Click()" runat="server" >
    </asp:button>

    or

    In the page.load SubmitOrder.Attrubutes.Add
    ("onclick", "OnVerifySubmit_Click()")

    Appreciate your help

    Thanks
    Krishna
     
    Krishna, Nov 22, 2003
    #1
    1. Advertisements

  2. Krishna

    Alvin Bruney Guest

    Onclick runs client side generated code, onserverclick runs server side
    code. These hooks are provided for controls that derive from htmlcontainer
    base controls.

    Either will do. It's a matter of style really.

    Regards
     
    Alvin Bruney, Nov 23, 2003
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.