@srilakshmim
<from singamalai>
Hello madam, my name is singamalai.
in the above code in "TextBox txtcity = (textbox)row.findcontrol("txtcity");"
i'm getting the default value which is not updated, but not updated value. please help me to update a record.
this is my code.
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int index = GridView1.EditIndex;
GridViewRow row = GridView1.Rows[index];
string nametxt = GridView1.DataKeys[e.RowIndex].Value.ToString(); //row.Cells[2].Text; //GridView1.Rows[e.RowIndex].Cells[2].Text;
TextBox txtmyname = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtmyname"); //((TextBox)row.FindControl("txtmyname")).Text;
string txtbname = ((TextBox)row.FindControl("txtbname")).Text;
string txtmobile = ((TextBox)row.FindControl("txtmobile")).Text;
string txtemail = ((TextBox)row.FindControl("txtemail")).Text;
con.Open();
cmd = new OleDbCommand("update reg_table set myname='" + txtmyname.Text + "',bname = '" + txtbname + "',mobile = '" + txtmobile + "', email = '" + txtemail + "' where myname='" + nametxt + "' ", con);
int i = cmd.ExecuteNonQuery();
if (i > 0)
Response.Write("<h3> updated successfully");
else
Response.Write("<h3> Not updated");
con.Close();
//ds = (DataSet)Session["ds1"];
//ds.Tables["reg_table"].Rows[e.RowIndex]["myname"] = txtmyname;
}
please help me.
Thanks and regards,
singamalai.
simhamalai@india.com