标签:
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+"‘)");
}
}
数据绑定 添加操作的按钮
标签:
原文地址:http://www.cnblogs.com/camelroyu/p/4502720.html