|
-
December 29th, 2009, 06:34 AM
#1
onCommand vs onClick for Buttons
I am wondering why there is onCommand and onClick both events for ASP:Button controls. What special purpose do they serve.
-
December 29th, 2009, 09:08 AM
#2
Re: onCommand vs onClick for Buttons
have you already read the explanation on msdn? I don't think so.
OnCommand
OnClick
the main difference is that
The Command event is raised through the control hierarchy in the form of the BubbleEvent.
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 30th, 2009, 05:01 AM
#3
Re: onCommand vs onClick for Buttons
Actually I read it earlier but could not get the concept of 'BubbleEvent' clearly. Can you explain it.
-
December 30th, 2009, 05:27 AM
#4
Re: onCommand vs onClick for Buttons
this means that when a Button is nested for example in a DataGrid, then the DataGrid's OnBubbleEvent method is automaticaly called... and so forth
Use the OnBubbleEvent method to pass an event raised by a control within the container up the page's UI server control hierarchy.
additionally you can specify the CommandName and CommandArgument.
OnBubbleEvent
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 31st, 2009, 02:41 AM
#5
Re: onCommand vs onClick for Buttons
does it have any practical significance.
if we have some buttons inside a GridView and every button has some CommandArguement. how can we use them. should we implement a Command event for every button of a Command Event for GridView.
-
December 31st, 2009, 03:30 AM
#6
Re: onCommand vs onClick for Buttons
here's a nice explanation of event bubbling: http://www.4guysfromrolla.com/articles/051105-1.aspx
 Originally Posted by msdn
The Command event is raised when the Button control is clicked. This event is commonly used when a command name, such as Sort, is associated with the Button control. This allows you to create multiple Button controls on a Web page and programmatically determine which Button control is clicked.
it looks like the Command event is a general click-event handler for a group of buttons and the CommandName property helps to distinguish which button was cliked.
but although I understand the whole concept I don't know why would I want to bubble the command event-
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 31st, 2009, 06:42 AM
#7
Re: onCommand vs onClick for Buttons
 Originally Posted by memeloo
but although I understand the whole concept I don't know why would I want to bubble the command event-
That is exactly the same thing I am thinking about right now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|