我需要根据某些条件全局禁用删除按钮?
以下解决方案对我不起作用: http: //csharpbits.notaclue.net/2009/07/securing-dynamic-data-preview-4-refresh.html http://csharpbits.notaclue.net/2008/05/动态数据-杂项-位-part-6.html
同样,我不想进入每个列表和详细信息页面并在那里禁用它。
我需要根据某些条件全局禁用删除按钮?
以下解决方案对我不起作用: http: //csharpbits.notaclue.net/2009/07/securing-dynamic-data-preview-4-refresh.html http://csharpbits.notaclue.net/2008/05/动态数据-杂项-位-part-6.html
同样,我不想进入每个列表和详细信息页面并在那里禁用它。
为什么不只是从按钮扩展/继承。您可以制作自己的“知道”如何检查是否应该隐藏的按钮:
public class MyButton : Button
{
public void HiddenCheck()
{
bool visible = true;
//Check to see if the button should be hidden
this.Visible = visible;
}
}
然后,只要您需要删除按钮功能,只需使用此按钮而不是“System.Web.UI.WebControls.Button”按钮即可。
- 使其“启用”。我再次阅读了这篇文章,我猜你并没有试图“隐藏”按钮,而是禁用它。这个想法是一样的。