Fix: LinkButton Doesn’t Looked Disabled in ASP.NET 4

I couldn’t figure out why the LinkButtons in my former ASP.NET 3.5 site suddenly wouldn’t look disabled even though I was setting

lnkbtn.Enabled = False

 

The quick fix was to check the web.config file to ensure a new ASP.NET 4 setting:

<pages  controlRenderingCompatibilityVersion="3.5"

      clientIDMode="AutoID">

I’m not sure how controlRenderingCompatibilityVersion disappeared from the web.config, but, as you know, *&$% happens.

For a more detailed explanation as to why you might not need this setting in ASP.NET 4, check out Handling Disabled Links in ASP.NET 4 by fellow MVP Imar Spaanjaars.

Ken

No Comments