在gridview中看不到特定行的链接按钮 [英] Invisible a link buttons for a particular row in gridview

查看:77
本文介绍了在gridview中看不到特定行的链接按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个开发的gridview,其链接按钮为Modify,Remove,其他列为ID,名称,电子邮件地址,用户名等.

我的问题是,如果Name ="Primary",那么Modify和Remove链接按钮应该仅对于该行是不可见的,对于其他行,这些按钮应该是可见的.请建议我该怎么做,请将代码示例发送给我.
我正在使用以下代码:

I have a developed gridview with the link buttons as Modify, Remove and other columns as Id,Name, Email Address, Username etc.

My problem is, if the Name ="Primary" then Modify and Remove link buttons should be invisible for that row only, for other rows those buttons should be visible. Please suggest me how to do this, please send me the code samples.
I am using the following code:

if (tempContact.Primary==true)
{
System.Web.UI.WebControls.LinkButton remove = System.Web.UI.WebControls.LinkButton)e.Row.Cells[4].FindControl("lkbEmailRemove"); 
remove.Visible = false;
}



但这是否也删除了所有其他行的链接按钮.

很紧急.

感谢您的快速响应.

谢谢,
Nag



But is it removing the link button for all other rows also.

Its kind of urgent.

Appreciate your quick response.

Thanks,
Nag

推荐答案

您可以使用RowDataBound事件,然后在其中禁用所需的按钮.

请参阅​​ http://msdn.microsoft.com/en-us/library /system.web.ui.webcontrols.gridview.rowdatabound [ ^ ]

希望能帮助到你.让我知道您是否需要更多帮助.
You can use RowDataBound event and there you can disable the button that you need.

See http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound[^]

Hope it helps. Let me know if you need more assistance.


下面的链接应为您提供有关操作方法的想法

hide-disable-commandfield-gridview [
The below link should give you an idea on how to do it

hide-disable-commandfield-gridview[^]


这篇关于在gridview中看不到特定行的链接按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆