如何显示/隐藏gridview项目模板内的图像按钮 [英] How to show /Hide an image button that is inside gridview Item Template
本文介绍了如何显示/隐藏gridview项目模板内的图像按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何显示/隐藏gridview内的图像按钮项目模板
How to show /Hide an image button that is inside gridview Item Template
推荐答案
解决方案
RowDataBound
事件,找到控件。- 运行逻辑并将
Visible
属性设置为true / false
。
Solution
- Inside the
RowDataBound
Event, find the control.- Run your logic and set
Visible
property totrue/false
.
protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if(someCondition)
{
ImageButton imgBtn= (ImageButton)e.Row.FindControl("imageButtonId");
imgBtn.Visible = false;
}
}
}
这篇关于如何显示/隐藏gridview项目模板内的图像按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文