gridview在进入编辑模式后,如何获取用户修改后的值?
对应的列用的是BoundField 而不是采用的模板列
<asp:BoundField DataField="Pwd" HeaderText="密码">
</asp:BoundField>
比如有一列是这个字段 如何在编辑模式下获取用户修改后的值?还有一个 如何在进入编辑模式下 只能修改gridv中的一列的值??
对应的列用的是BoundField 而不是采用的模板列
<asp:BoundField DataField="Pwd" HeaderText="密码">
</asp:BoundField>
比如有一列是这个字段 如何在编辑模式下获取用户修改后的值?还有一个 如何在进入编辑模式下 只能修改gridv中的一列的值??
在RowUpdating事件中获取:
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string pw = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
Response.Write(pw);
}
应该在EditItemComplate里边读取的。
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
bind();
string pw = ((TextBox)GridView1.Rows[e.NewEditIndex].Cells[2].Controls[0]).Text;
Response.Write(pw);
}