protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
SqlConnection con = new SqlConnection("data source=shankar-pc\\shankar ; initial catalog=master;user id= sa;password=password@1");
con.Open();
string username = GridView1.DataKeys[e.RowIndex].Values["name"].ToString();
//TextBox txtcity = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtUserName");
TextBox txtName = GridView1.Rows[e.RowIndex].FindControl("txtUserName") as TextBox;
string s = txtName.Text.Trim();
string age = GridView1.DataKeys[e.RowIndex].Values["age"].ToString();
SqlCommand cmd = new SqlCommand("update personaldetails set name='" + txtName.Text.Trim() + "'where age=" + age, con);
cmd.ExecuteNonQuery();
con.Close();
}
-----------------------------this is showing name=system.web.UI.Controls.TextBox
I WANT THAT WHEN I AUTOGNERATE UPDATE BUTTON IN GRDVIEW THE TEXT AFTER EDITING IS DISPLAYED