Disable ASP.NET Form Button

When providing buttons on a web page, we may wish to show a particular button as ‘greyed out’, signifying that it is more generally available for use, but not for the task we are undertaking.

An example of this would be an edit button.

If the content we are adding (perhaps the details for a user) is new then it would be inappropriate to be able to click on a button to edit the details.

In this example the editor used is Visual Studio as a part of a DotNetNuke module. The file edited is the presentation view, perhaps a file called default.ascx.

To grey the text on a button simply add the word disabled to the button definition.

<input id=”edit” “disabled” type=”submit” value=”Edit” name=”edit”>

It looks strange but I’ve found that the word disabled should be within speech marks.