Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Unable to Update Gridview

$
0
0

when I preforming the Update in grid view , its unable to updatating.

protected void gvPerson_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txttitle;
        txttitle = (TextBox)gvPerson.Rows[e.RowIndex].Cells[4].Controls[0];
        TextBox txtname = (TextBox)gvPerson.Rows[e.RowIndex].Cells[5].Controls[0];
        TextBox txtpassword = (TextBox)gvPerson.Rows[e.RowIndex].Cells[6].Controls[0];
        TextBox txtmobilnumber = (TextBox)gvPerson.Rows[e.RowIndex].Cells[7].Controls[0];
        TextBox txtemail = (TextBox)gvPerson.Rows[e.RowIndex].Cells[8].Controls[0];
        TextBox createddatetime = (TextBox)gvPerson.Rows[e.RowIndex].Cells[9].Controls[0];
        TextBox txtcreatorname = (TextBox)gvPerson.Rows[e.RowIndex].Cells[10].Controls[0];

        string userid = gvPerson.Rows[e.RowIndex].Cells[3].Text;
        cmd.Connection = con;
        cmd.CommandText = "update Addnewuser set Title='" + txttitle + "',Name='" + txtname + "',Password='" + txtpassword + "',MobileNumber='" + txtmobilnumber + "',EmailID='" + txtemail + "',CreatorName='" + txtcreatorname+ "' where UserId='" + userid+"'";
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
        gvPerson.EditIndex = -1;
        fillgrid();

    }


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>