New Features of ASP. NET 4.0, outputs more pure HTML code clientidmode, viewstatemode, etc.
1. in ASP. NET 4.0, we can control the format of the Object ID in the output html. We often see the ID similar to this before.
Ctl00_maincontent_txtautoid
This is inconvenient to control the client, and has little practical significance.
Now we can modify the output format of clientid by setting the clientidmode of the control. For exampleCode:
View Source
Print?
1 |
Asp: textbox id = "txtpredictable" runat = "server" clientidmode = "predictable" > Asp: textbox |
2 |
Asp: textbox id = "txtautoid" runat = "server" clientidmode = "autoid" > Asp: textbox |
3 |
Asp: textbox id = "txtinherit" runat = "server" clientidmode = "inherit" > Asp: textbox |
4 |
< ASP: textbox ID = "Txtstatic" Runat = "Server" Clientidmode = "Static" > </ ASP: textbox > |
Output separately
View Source
Print?
1 |
< Input Name = "Ctl00 $ maincontent $ txtpredictable" Type = "Text" ID = "Maincontent_txtpredictable" /> |
2 |
< Input Name = "Ctl00 $ maincontent $ txtautoid" Type = "Text" ID = "Ctl00_maincontent_txtautoid" /> |
3 |
< Input Name = "Ctl00 $ maincontent $ txtinherit" Type = "Text" ID = "Maincontent_txtinherit" /> |
4 |
< Input Name = "Ctl00 $ maincontent $ txtstatic" Type = "Text" ID = "Txtstatic" /> |
Autoid: the automatic output is the same as the clientid output in earlier versions.
Static: output the same ID as the ID specified by the server.
Predictable: listview is particularly useful for DataGrid, so that the clientid value format is the same as clientidrowsuffix;
Inherit: This value specifies that the control generates an id like its parent object, that is, we often say inheritance.
2. asp. net4.0 provides a new attribute called viewstatemode.You can set the view status of the controller separately. In the previous versions of ASP. NET, the control view can be separately controlled only when the page viewstate is enabled. In ASP. net4.0, the view status of the control can be set separately. That is to say, the control can still enable the view status even if the view status of the page is not enabled.
The viewstatemode attribute has three values:
Inherit: The view State inherits from the parent control;
Enabled: Enable the view status of the parent control even if the view status of the control is not enabled;
Disabled: even if the view status of the parent control is enabled, the view status of the control is disabled.
3. checkboxlist, radiobuttonlist, and menu Controls Support the use of UL or ol to output HTML. It is easy to know that this is the case and it is enough to use it.
Reading about new features of Asp.net:
1. Start with the page tag <%>
2. in ASP. NET 4.0, you can use a custom provider for outputcache.
3. Enhanced Seo support for metakeywords, metadegion, and redirectpermanant
4. Seo-enhanced URL Routing
5. Enter more pure HTML code, viewstatemode, clientidmode, and checkboxlist.