zoukankan      html  css  js  c++  java
  • 手动写GridView的RowEditing RowCancelingEdit RowUpdating RowDeleting 事件 和 删除 出现提示

    先定一个绑定的方法 
    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();
        }

     protected void GridViewUser_RowUpdating(object sender, GridViewUpdateEventArgs 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('你确认要删吗?')");
                }

            }

        }
  • 相关阅读:
    经典数据结构-红黑树
    POI excel处理
    Spring事务控制
    现代医院信息化建设策略与实践
    医院信息平台管理(医院信息集成平台)—— 概念扫盲
    医疗知识图谱的构建和应用
    常用日志采集框架对比
    CSS编码规范
    HTML编码规范
    【安全等保】Linux服务器基线安全--干货
  • 原文地址:https://www.cnblogs.com/a121984376/p/1245906.html
Copyright © 2011-2022 走看看