protected void GridViewUser_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
我在上面的事件里写了更新的方法,可是更新后,gridview的编辑模式不取消,还处在编辑的状态下··
但是数据已经更新了···请问改怎么解决啊?
{
}
我在上面的事件里写了更新的方法,可是更新后,gridview的编辑模式不取消,还处在编辑的状态下··
但是数据已经更新了···请问改怎么解决啊?
解决方案 »
- Asp.net的treeview怎样显示根节点????
- 关于Project Web Access 中的项目组合分析器里视图的问题
- 如何生成“广告管理”的专用代码?(通过在网页中添加一条专用代码,从而在WEB中方便的显示出广告。)
- 如何提升权限?我只记得有人说过改machine.config里的什么东西,但是我忘了
- 我想定义一个全局字符串变量,在全部的页面都可以访问他的值。请给出代码
- (在线等)关于checkboxlist的问题,如何从数据库里读出多个值,显示在checkboxlist上选择的项!
- 關於文件上傳,自動生成文件名的問題
- 在aspx页面里怎样取得对方的IP地址
- 急!!!求助,100分
- 祝贺大家毕业快乐
- DataReader 读不出数据!
- 按年月查表里的信息..
这个事件 我也写了 protected void GridViewUser_RowEditing(object sender, GridViewEditEventArgs e)
{
//索引编辑时
this.GridViewUser.EditIndex = e.NewEditIndex;
Bind();
}
protected void GridViewUser_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
//编辑结束时
this.GridViewUser.EditIndex = -1;
Bind();
}
this.GridViewUser.EditIndex = -1;
不就OK了吗?
{
string username = this.GridViewUser.DataKeys[e.RowIndex].Value.ToString();
string name = ((TextBox)(this.GridViewUser.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim();
string policeID = ((TextBox)(this.GridViewUser.Rows[e.RowIndex].Cells[3].Controls[0])).Text.Trim();
string department = ((TextBox)(this.GridViewUser.Rows[e.RowIndex].Cells[4].Controls[0])).Text.Trim();
string role = ((DropDownList)this.GridViewUser.Rows[e.RowIndex].FindControl("DropDownRole")).SelectedValue;
//更新参数的方法
new BILL.OperateUser().UpdateUser(username, name, policeID, department, role);
//重新绑定
this.GridViewUser.DataSource = new BILL.OperateUser().SelectOneUser(this.edtUserID.Text, this.edtName.Text, this.edtPoliceNumber.Text, this.edtDepartment.Text, " ");
this.GridViewUser.DataBind();
this .GridViewUser.EditIndex = -1;
this.GridViewUser.SelectedIndex = -1; } protected void GridViewUser_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
//this.GridViewUser.DataSource = new BILL.OperateUser().SelectOneUser(this.edtUserID.Text, this.edtName.Text, this.edtPoliceNumber.Text, this.edtDepartment.Text, " ");
//this.GridViewUser.DataBind();
e.KeepInEditMode = false;
this.GridViewUser.EditIndex = -1;
this.GridViewUser.SelectedIndex = -1;
//Bind();
}