Data Grid Events

The Data Grid control supports several events.

One of them, the Item Created event,gives you a way to customize the item-creation process. The item Data Bound event also gives you the ability to customize the Data Grid item, but after the data is available for inspection. For example, if you were using the Data Grid control to display to do list, you could display overdue items in red text, completed items in black text and other tasks in green text.

The remaining event are raised in response to button or link button clicked in grid items They are designed to implement common data manipulation tasks. Four events of this type are supported:

Edit command

Delete Command

Update Command

Cancel command

When the user clicks one of the button (labeled by default Edit, Delete, Update, or Cancel ,respectively ),the corresponding event is raised.

The data Grid control also supports the item Command event that is raised when a user clicks a button that is not one of the predefined buttons above. This even can be used for custom functions by setting a button’s command Name property to a value needed, and then testing for it in the item command event handler.

(For example. You could use this approach when selecting an item , as documented in allowing Users to select item in a data list web server control.) by default, a data grid simply displays all columns control’s Auto generate Columns property, columns can be created individually to have more control over the formatting.


No comments:

Post a Comment