views:

278

answers:

1

I need to 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.

A: 

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.

RepDetec