Asp.Net GridView 3

Assalamualaykum Wr Br…In this post we would like to explore the few events of Asp.Net GridView. Lets explore RowEditing, RowUpdating Events here. Goto Properties of the GridView and click the Events tab as shown:
You can see list of events of Gridview like SelectedIndexChanged, RowCancelingEdit, RowCommand,RowDeleted, RowDeleting, RowUpdated, RowUpdating etc.
Double click the RowEditing Event textbox in the property strip that takes you to the eventhandler method as shown below:
The above pic have RowEditing, RowDataBound Events whose code is shown.
RowDataBound event is used to bind data to specific row which is called foreach row.
We can filter out the execution of RowDataBound specific to Controls, as in our case we are finding out dropdownlist controls. we create reference entity of DropDownList ad to which FindControl method of GridViewRowEventArguments. Specify the control id of Dropdownlist as parameter to FindControl method. Later we execute the establish connection, execute the command and binds to dropdownlist, whose output is as shown:
Thats all for the day..Hope enjoyed…
Jazakallah Khair…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s