Today I am giving you introduction of what’s new in asp.net 4.0.I hope it will help you
Setting Meta tag with Page
Asp.net 4.o added two new property like MetaKeyWords and MetaDescription. This property represents corresponding Meta
tag in your Page
<head id="Head1" runat="server">
<title>My Page Title</title>
<meta name="keywords" content="Asp.net,Net,MVC,new' />
<meta name="description" content="My asp.net 4.o new feature article" />
Content of description metatag are use for search listing preview for google.
ViewStateMode Property (for Enable view state for individual control)
By default view state is enable for page, with the result each control of page are potentially store view state data in page so page size is increase that’s why performance is degrade. In earlier virsion developer can do that thing to disable view state but he want to disable for all control. Now in asp.net 4.0 new viewstatemode property introduce which take following enumerated data type like Enable, Disable, Inherit.
For disable viewstatemode for page set viewstatemode property is disabling then whatever control you need viewstatemode enable this property for that control.
See following example
See above example ViewStateMode is Desable so for all control
CHANGES TO BROWSER CAPABILITIES
The HttpBrowserCapabilities object is driven by a set of browser definition files. These files contain information about the capabilities of particular browsers. In ASP.NET 4, these browser definition files have been updated to contain information about recently introduced browsers and devices such as Google Chrome, Research in Motion BlackBerry smartphones, and Apple iPhone.
ROUTING IN ASP.NET 4
Asp.net add built in support for using routing in web farm.Routing is nothing it just configure URL does not map with physical URll, you can use routing for display URl in meaningful way. For Example you want to display article for cshap category
By routing you can configure Application can accept below URL to render same information above URL
SETTING CLIENT IDS
ASP.NET CHART CONTROL
The ASP.NET Chart control expands the data-visualization offerings in the .NET Framework. Using the Chart control, you can create ASP.NET pages that have intuitive and visually compelling charts for complex statistical or financial analysis. The ASP.NET Chart control was introduced as an add-on to the .NET Framework version 3.5 SP1 release and is part of the .NET Framework 4 release.
THE ABILITY TO PERSIST SELECTED ROWS IN DATA CONTROLS
Gridview and listview control eable user to select row.In previous version of asp.net row selection is based on row index on page. For example if you select page1 item no 3 and move to page 2 then on page 2 item no 3 is selected, so it is not desirable.now in asp.net 4.0 support Persisted Selection, a new feature in asp.net 4.0 using PersistedSelection property of grideview or listview if property is true then if you go to page 2 then no item is selected if you go back to page 1 then item no 3 is selected.
<asp:GridView id="gdEmployee" runat="server" PersistedSelection="true"></asp:GridView>
control is enhanced to make it easier to style the content of the control with CSS. In previous versions of ASP.NET, the FormView
control rendered it contents using an item template. This made styling more difficult in the markup because unexpected table row and table cell tags were rendered by the control. Now in asp net 4.o have RenderTable property which can set true or false if we set false then control are not rendered as table and row html format so it is easier to apply css style on content of control.
<asp:FormView ID="FrvEmployee" runat="server" RenderTable="false">
In ASP.NET 4, the ListView control does not require a layout template.
<asp:ListView ID="LvEmployee" runat="server">
CHECKBOXLIST AND RADIOBUTTONLIST CONTROL ENHANCEMENTS
In ASP.NET 3.5, you can specify layout for the CheckBoxList andRadioButtonList using the following two settings:
- Flow. The control renders span elements to contain its content.
- Table. The control renders a table element to contain its content.
In ASP.NET 4, the CheckBoxList and RadioButtonList controls support the following new values for the RepeatLayout property:
- OrderedList – The content is rendered as li elements within anol element.
- UnorderedList – The content is rendered as li elements within aul element.
MENU CONTROL IMPROVEMENTS
Before ASP.NET 4, the Menu control rendered a series of HTML tables. This made it more difficult to apply CSS styles outside of setting inline properties and was also not compliant with accessibility standards.
In ASP.NET 4, the control now renders HTML using semantic markup that consists of an unordered list and list elements. The following example shows markup in an ASP.NET page for the Menu control.
<asp:Menu ID="MainMenu" runat="server">
<Items> <asp:MenuItem Text="Home" Value="Home" />
When the page renders, the control produces the following HTML (the onclick code has been omitted for clarity):
<li><a href="#" onclick="...">Home</a></li>
WIZARD AND CREATEUSERWIZARD CONTROLS
ASP.NET 4, you can create a LayoutTemplate template and insertPlaceHolder controls (using reserved names) to specify how you want the Wizard control to render. The following example shows this:
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" ActiveStepIndex="1">
<asp:PlaceHolder ID="headerPlaceholder" runat="server" />
<asp:PlaceHolder ID="sideBarPlaceholder" runat="server" />
<asp:PlaceHolder id="wizardStepPlaceholder" runat="server" />
<asp:PlaceHolder id="navigationPlaceholder" runat="server" />
so guys we meet in few day with new topic.thank for reading.