469,631 Members | 1,043 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

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

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
Nov 18 '05 #1
1 5958
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

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Krishna" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
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

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sedef | last post: by
3 posts views Thread by Chris Dunaway | last post: by
2 posts views Thread by Web learner | last post: by
reply views Thread by Roberto Kohler | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.