码迷,mamicode.com
首页 > 其他好文 > 详细

bianwu

时间:2015-05-14 11:39:03      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

  protected void gv1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
                //首先判断是否是数据行
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    //如果是绑定数据行  增加删除按钮 弹出消息,先引用LTP
                    LinkButton linkbtnEdit = (LinkButton)e.Row.FindControl("lnkbtnEdit");
                    linkbtnEdit.CommandArgument = e.Row.RowIndex.ToString();
                    LinkButton linkbtnDel = (LinkButton)e.Row.FindControl("lnkbtnDel");
                    linkbtnDel.Attributes.Add("onclick", "return confirm(\"你确认要删除吗\")");
                    linkbtnDel.CommandArgument = e.Row.RowIndex.ToString();
                    // /*当鼠标停留时更改背景色
                    //第二种方法 配合前端java函数
                    e.Row.Attributes.Add("onmouseover", "if(this!=oldrow){currentcolor=this.style.backgroundColor;this.style.backgroundColor=‘Lavender‘,this.style.fontWeight=‘‘;}");
                    e.Row.Attributes.Add("onmouseout", "if(this!=oldrow){this.style.backgroundColor=currentcolor;this.style.fontWeight=‘‘;}");
                    string curInteid = gv1.DataKeys[e.Row.RowIndex].Value.ToString();
                    e.Row.Attributes.Add("onclick", e.Row.ClientID.ToString() + ".checked=true;selectx(this,‘"+curInteid+"‘)");
                }
          
        }

 

数据绑定 添加操作的按钮

 

bianwu

标签:

原文地址:http://www.cnblogs.com/camelroyu/p/4502720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!