Editing Rows In GridView


Today I was trying to create a GridView with built in row editing. The first thing I did was make sure that the GridView had the property: AutoGenerateEditButton=”True”. The rows I needed to edit were DropDownLists. Then I was trying to find the code to the edit area and came across this:

 if ((e.Row.RowState & DataControlRowState.Edit) > 0)
 {
     // Edit mode code here
 }

 else
 {
      // View mode code here
 }

You can also edit every other row using: DataControlRowState.Alternate.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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