Since the OP asked how to do this with a DIV with runat = "server", I thought I would add a solution for this:
myDiv.Attributes.Add("Disabled", "");
The fact that the panel with Enabled = false is displayed in any case and does not require changes in your code. There is no need for an attribute value (for example, True), since the presence of the attribute itself is sufficient.
Note. To re-enable the DIV, you cannot just set the Disabled attribute to False. You must remove the alltogether attribute:
myDiv.Attributes.Remove("Disabled");
source share