how to get cell value of gridview in asp.net C# in text box
I have one gridview in that there are 4 columns namely "User ID","Description","Display Password","Change Password". I have put an Image Button in Change Password Column for each cell. Below the Gridview there are 3 text boxes. When I click on Change Password, the User ID of that particular row should be displayed in text box 1. How to do this in asp.net with C# and back end is MySql DB server.
Abumiyan MuqriPosted May 31, 2012, 1:54 AM
Thanks for replying... Bt still i m getting error at
txtID.Text = gvrow.Cells[0].Text; step.
when i m typing this line in my code it is not giving any option of "Cells", instead giving "CellSpacing" and "CellPadding" . what to do now?
Please Help..
Krishna GaradPosted May 31, 2012, 12:58 AM
in button click event
imagebutton_Click(....)
{
ImageButton btndetails = sender as ImageButton;
GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;
txtID.Text = gvrow.Cells[0].Text;
txtname.Text = gvrow.Cells[1].Text;
txtsomeone.Text = gvrow.Cells[2].Text;
}