Default for ClientIDMode in ASP.NET 4

What is the default for ClientIdMode in

a) Page
b) Control
c) UserControl

From what I've read, predictable, inherit, inherit. I was expecting AutoId to be the default on the page. Wouldn't it be predictable to break things?

+2


a source to share


2 answers


MSDN says:

The default ClientIDMode

for the page Predictable

. the default ClientIDMode

for the control is Inherit

. Since the default for controls Inherit

, the default generation mode Predictable

. (However, if you are using Visual Studio to convert an ASP.NET 4 Web project from an earlier version, Visual Studio automatically sets the site to the default AutoID

in the file Web.config

.)



But it should also be mentioned that some old pages on MSDN still say the default ClientIDMode

for a page AutoID

(like here ), as pointed out in my previous answer.

+2


a source


"The default ClientIDMode for the page is predictable.

"However, if you are using Visual Studio to convert an ASP.NET 4 web project from an earlier version, Visual Studio automatically sets the default AutoID for the site in the Web.config file."

http://msdn.microsoft.com/en-us/library/system.web.ui.clientidmode.aspx

If you set it on a control use the value of the control



else if you set it on the page use the page value

else if you entered it in your web.config use the value in your web.config

else use Predictable.

Any of them can and will break the code if the programmer has assumed that he is doing something different from what he is actually doing.

0


a source







All Articles