I have a gridview with Edit commandfield. In one of the templatefield of the gridview,I have a textbox inside edit item template. In the RowUpdating event, I try to get the value of the textbox.
TextBox text = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtfname");
GridViewRow row =GridView1.Rows[e.RowIndex] as GridViewRow;
TextBox tFirstName = row.FindControl("txtfname") as TextBox;
TextBox textFName = (TextBox)row.Cells[0].Controls[3];
I tried all three methods.When I put
if(!IsPostBack)Bind_grid();
I get the textbox.text value as empty.If I remove that condition I get the value which was bound on the control using Bind function in the markup page.I never got the value I am editing in the control.
Where am I going wrong? Solution?