Link to home
Start Free TrialLog in
Avatar of vzorn
vzornFlag for United States of America

asked on

Gridview setting rowstate to edit not working

I have a gridview where I am trying to set a row to edit mode if the datakey is the session key.
I am able to pull the key but it is not setting the row to edit mode.  Here is the code I tried.  I put it on the rowdatabound event.

e.Row.RowState = DataControlRowState.Edit

i also tried
gvFabricDetail.EditIndex = -1

Please help!!
Avatar of madhevan_pillai
madhevan_pillai
Flag of India image

gvFabricDetail.EditIndex = 0
:

:

or
gvFabricDetail.EditIndex = 1

you have to specify the edit row index not -1
Avatar of vzorn

ASKER

gvFabricDetail.EditIndex = 0
makes the first row in edit mode, but not the row where the datakey matches.

I use this first
Dim vid As String = gvFabricDetail.DataKeys(e.Row.RowIndex).Value.ToString
to get the datakey and if it matches then
gvFabricDetail.EditIndex =0

Any ideas??
Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Velio
Velio
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial