手动写GridView的RowEditing RowCancelingEdit RowUpdating RowDeleting 事件 和 删除 出现提示
来源:互联网 发布:mac电脑使用入门 编辑:程序博客网 时间:2024/05/22 15:45
先定一个绑定的方法
void Bind()
...{
this.GridViewUser.DataSource = new BILL.OperateUser().SelectOneUserSqlComd();
this.GridViewUser.DataBind();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
...{
//索引编辑时
this.GridViewUser.EditIndex = e.NewEditIndex;
Bind();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
...{
//编辑结束时
this.GridViewUser.EditIndex = -1;
Bind();
}
...{
//索引编辑时
this.GridViewUser.EditIndex = e.NewEditIndex;
Bind();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
...{
//编辑结束时
this.GridViewUser.EditIndex = -1;
Bind();
}
GridView的AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
//删除出现提示
protected void GridViewUser_RowDataBound(object sender, GridViewRowEventArgs e)
...{
//如果是绑定数据行
if (e.Row.RowType == DataControlRowType.DataRow)
...{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
...{ //找到生成“删除”所在单元格
LinkButton lb = (LinkButton)e.Row.Cells[0].Controls[2];
lb.Attributes.Add("onclick", "javascript:return confirm('你确认要删吗?')");
}
}
}
//删除出现提示
protected void GridViewUser_RowDataBound(object sender, GridViewRowEventArgs e)
...{
//如果是绑定数据行
if (e.Row.RowType == DataControlRowType.DataRow)
...{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
...{ //找到生成“删除”所在单元格
LinkButton lb = (LinkButton)e.Row.Cells[0].Controls[2];
lb.Attributes.Add("onclick", "javascript:return confirm('你确认要删吗?')");
}
}
}
- 手动写GridView的RowEditing RowCancelingEdit RowUpdating RowDeleting 事件 和 删除 出现提示
- GridView.RowUpdating 事件
- GridView“gv_Info”激发了未处理的事件“RowEditing” “RowEditing”
- GridView激发了未处理的事件RowDeleting
- gridview激发了未处理的事件RowDeleting
- gridview激发了未处理的事件RowDeleting
- GridView“GridView1”激发了未处理的事件“RowDeleting” 的出现原因及解决方法
- 以GridView控件的RowUpdating事件说明如何退出事件
- GridView的RowUpdating事件抓取新值时的问题
- GridView“gvShow”激发了未处理的事件“RowDeleting”解决办法
- GridView“GridView1”激发了未处理的事件“RowDeleting”
- GridView“gvShow”激发了未处理的事件“RowDeleting”解决办法
- GridView“GridView1”激发了未处理的事件“RowDeleting"(转)
- GridView“GridView1”激发了未处理的事件“RowDeleting”
- GridView“GridView1”激发了未处理的事件“RowDeleting”
- GridView“GridView1”激发了未处理的事件“RowDeleting”
- GridView“gv_res”激发了未处理的事件“RowDeleting”。
- GridView的删除提示
- CheckBoxList 的数据绑定及数据获取
- 自定义报表开发、使用手册
- 数据结构与算法系列---顺序表
- [转]vsftp配置大全
- Delegate和泛型结合运用(一)
- 手动写GridView的RowEditing RowCancelingEdit RowUpdating RowDeleting 事件 和 删除 出现提示
- MATLAB 2008
- cookie读取
- 将gridview数据源导出到EXCEL
- SQL企业管理器中文乱码解决
- 中文搜索引擎提交入口
- java 数值类型转换时,如果格式不对
- VB.net——窗体相互操作的问题解决
- 数据结构与算法系列---单链表