我正在尝试在GridView中更新数据,当我单击“编辑”时,数据被绑定并显示在TextBox中,但是当我单击“ Update”并对其进行调试时,TextBox返回空值并使用该空值进行更新
protected void grdCustomer_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox txtUserName = (TextBox)grdCustomer.Rows[e.RowIndex].FindControl("txtUserName");
command = new SqlCommand("Users_Update", connection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("Names", txtUserName.Text);
command.ExecuteNonQuery();
grdCustomer.EditIndex = -1;
GetData();
}