gridview中,自定义添加了一个linkbutton按钮,我想点击某行的linkbutton,此行背景色改变,如何做?
2个回答
展开全部
在gridview中编辑模板,然后双击Linkbutton,生成事件
protected void LinkButton1_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
GridViewRow gvr = (GridViewRow)lb.Parent.Parent;
gvr.BackColor = System.Drawing.Color.Red;
}
搞定!!!会变成红色
protected void LinkButton1_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
GridViewRow gvr = (GridViewRow)lb.Parent.Parent;
gvr.BackColor = System.Drawing.Color.Red;
}
搞定!!!会变成红色
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询