From http://www.cnblogs.com/BluceLee/
"
<Asp: button id = "button1" Runar = "server" onclick = "button#click"
Oncommand = "button#command">
Both onclick and oncommand are defined,
InCodeDefine related events in
Button#click (Object sender, eventargs e ){}
Buttonstmcommand (Object sender, commandeventargs e ){}
1. click the button to trigger the two events at the same time, But click the button first and then Run Command
2. Differences
Command can distinguish different buttons by setting commandname and commandargument,
You can use commandeventargs that contains event data to obtain or set
In click, you can also obtain commandname and commandargument in the form of (button) sender.
Example: onclick
<Asp: button id = "button1" Runar = "server"
Onclick = "button#click" commandname = "A" text = "A">
<Asp: button
Id = "button2" Runar = "server" onclick = "button#click" commandname = "B"
TEXT = "B">
<Asp: button id = "button3" Runar = "server"
Onclick = "button#click" commandname = "C" text = "C">
Define a button#click (Object
Sender, eventargs e) {} is enough,
Other buttons need to be used (button) sender. commandname to determine which button is used.
The oncommand is the same, except for E. commandname.
(Event registration can also be omitted in ASP. net2.0)
3. Both methods are server-side events. To add client events, you must use attributes to set the onclick client events for the button, for example:
Button1.attributes. Add ("onclick", "yourfunction ();")
You can also define the yourfunction () method on the ASPX page.
"