Click here to Skip to main content
15,904,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Using a dropdownlist iam selecting a row in gv(8th record),so now the gv is displaying only one row(8th record),when I click edit ,the editmode is pointing to first record in the grid(so now the grid is showing all the records and the editmode is pointing to the firstrecord in the gv).

I wanted the editmode to be pointing to the record which I have selected.I have tried the rowindex in many ways,but I couldn't fix it .Plz help.Thanks.This is mycodebehind:
C#
protected void editEmployee(object sender,GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;//here I should give the control
        BindGrid();

    }
Posted
Updated 12-May-14 20:14pm
v2

1 solution

hi
try this on
gridview_RowUpdating command

Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[1].Text);
by this u will get id on which you have clicked and update this record

Hope this will help.
Please mark if it helps you
 
Share this answer
 
Comments
saisrid 13-May-14 1:52am    
Thanks for your reply,
but it did not work,

I wanted the editmode to point to the record what I have selected,may be 5th record,
I want the rowindex pointing to selected row in a gv.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900