开发者

How to disable delete button in ASP.NET Dynamic Data?

开发者 https://www.devze.com 2022-12-13 09:30 出处:网络
I need to 开发者_Go百科disable delete button GLOBALLY based on some condition? The following solutions will not work for me:

I need to 开发者_Go百科disable delete button GLOBALLY based on some condition?

The following solutions will not work for me: http://csharpbits.notaclue.net/2009/07/securing-dynamic-data-preview-4-refresh.html http://csharpbits.notaclue.net/2008/05/dynamicdata-miscellaneous-bits-part-6.html

Again, I do not want to go into every list and detail page and disable it there.


Why not just extend/inherit from button. You could make your own button that "knows" how to check if it should be hidden:

public class MyButton : Button
{
    public void HiddenCheck()
    {
        bool visible = true;
        //Check to see if the button should be hidden
        this.Visible = visible;
    }
}

Then, just use this button instead of the "System.Web.UI.WebControls.Button" button wherever you need the delete button functionality.

-Make that "Enabled." I read the post again, and I guess you aren't trying to "hide" the button, but disable it. The idea is the same though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号