gridview的更新和取消的问题。网上有人问我说数据在update后还保持编辑的状态。怎么改变起状态。

时间:2025-01-27 07:13:35

 void BindData()
    {
        string sql = "select top 10 ID,jobno,jobfixno,jobtype from jobse";
        SqlDataAdapter myda = new SqlDataAdapter(sql, conn);
        DataSet ds = new DataSet();
        (ds, "RusTable");
        = ["RusTable"].DefaultView;
        ();
        ();
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        = ;
    }

    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        = -1;
        BindData();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox tb = (TextBox)[].FindControl("TextBox001");
        string dkvalue = [].();
        string sql1 = "update jobse set jobno='" + () + "' where id='" + dkvalue + "'";
        ();
        SqlCommand cmd = new SqlCommand(sql1, conn);
        ();
        ();
        = -1;
        BindData();
    }