Gets or sets the index of the row to edit.
Assembly: System.Web (in System.Web.dll)
The row index is zero-based (the first row is row zero).
This property is typically used only in the following scenarios, which involve handlers for specific events:
You want the GridView control to open in edit mode for a specific row the first time that the page is displayed. To do this, you can set the property in the handler for the Load event of the Page class or of the GridView control.
You want to know which row was edited after the row was updated. To do this, you can retrieve the row index from the property in the RowUpdated event handler.
You are binding the GridView control to a data source by setting the DataSource property programmatically. In this case you must set the property in the RowEditing and RowCancelingEdit event handlers.
If you set the property after a postback or in handlers for events that are raised later than the Load event, the GridView control might not enter edit mode for the specified row. If you read the value of this property in other event handlers, the index is not guaranteed to reflect the row that is being edited.
To determine which row the user has clicked an Edit button or hyperlink in before the GridView control enters edit mode, you can retrieve the row index from the NewEditIndex property of the GridViewEditEventArgs object in the RowEditing event handler.
To prevent the GridView control from entering edit mode after a user has clicked an Edit button or hyperlink, set the Cancel property of the GridViewEditEventArgs object to true in the RowEditing event handler.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.