button properties:- commandName and CommandArguments
What is basic difference between CommandName and CommandArguments properties which is used in Button Control tool.How it is used during programming开发者_JS百科 (using C#)?
CommandName : Gets or sets the command name associated with the Button control that is passed to the Command event e.g. Delete, Edit,...
Have a look at this article http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandname.aspx
CommandArguments : An optional parameter passed to the Command event along with the associated CommandName. The default value is String.Empty.
Have a look at this article http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandargument.aspx
These property play role when buttons are nested within container controls such as Repeater, GridView etc. On button click, typically, the container control will raise RowCommand event where you can refer to CommandName and CommandArgument values of button. CommandName allows to different between different buttons on the same row (Edit, Delete, Select etc) while CommandArgument is generally row identifier (can be index or primary key of the data being bound). Most of containers has a default mechanism to fill CommandArgument with row index if not specified.
精彩评论