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

I am not able extract textbox values while row updating...
Please check below code...

TextBox id =(TextBox) GridView1.Rows[e.RowIndex].FindControl("TextBox1");
TextBox username = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox2");
TextBox password = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox3");
Posted
Comments
Member 9601534 30-Nov-12 5:22am    
append with .ToString

1 solution

you have to use DataKeyNames as id in .aspx file of webpage and use DataKey to find id

eg
Assign datakeyname

<asp:gridview id="gvEG" runat="server" autogeneratecolumns="False" datakeynames="ID>


in .CS file use

Convert.ToInt64(gvEG.DataKeys[e.RowIndex].Values[0].ToString());
 
Share this answer
 
v2

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