CSS Improvements in Visual Studio 2010
One of the major areas of work in ASP.NET 4 Beta 2 has been around rendering HTML that is compliant with the latest HTML standards. This includes changes to how ASP.NET Web server controls use CSS styles.
Compatibility Setting for Rendering
By default, when a Web application or Web site targets the .NET Framework 4, the controlRenderingCompatibilityVersion attribute of the pages element is set to “4.0”. This element is defined in the machine-level Web.config file and by default applies to all ASP.NET 4 applications:
<system.web>
<pages controlRenderingCompatibilityVersion="3.5|4.0"/>
</system.web>
The value for controlRenderingCompatibility is a string, which allows potential new version definitions in future releases. In the current release, the following values are supported for this property:
· “3.5”. This setting indicates legacy rendering and markup. Markup rendered by controls is 100% backward compatible, and the setting of the xhtmlConformance property is honored.
· “4.0”. If the property has this setting, ASP.NET Web server controls do the following:
· The xhtmlConformance property is always treated as “Strict”. As a result, controls render XHTML 1.0 Strict markup.
· Disabling non-input controls no longer renders invalid styles.
· div elements around hidden fields are now styled so they do not interfere with user-created CSS rules.
· Menu controls render markup that is semantically correct and compliant with accessibility guidelines.
· Validation controls do not render inline styles.
· Controls that previously rendered border="0" (controls that derive from the ASP.NET Table control, and the ASP.NET Image control) no longer render this attribute.
Disabling Controls
In ASP.NET 3.5 SP1 and earlier versions, the framework renders the disabled attribute in the HTML markup for any control whose Enabled property set to false. However, according to the HTML 4.01 specification, only input elements should have this attribute.
In ASP.NET 4, you can set the controlRenderingCompatabilityVersion property to “3.5”, as in the following example:
<system.web>
<pages controlRenderingCompatibilityVersion="3.5"/>
</system.web>
You might create markup for a Label control like the following, which disables the control:
<asp:Label id="Label" runat="server" Text="Test" Enabled="false">
The Label control would render the following HTML:
<span id="Label1" disabled="disabled">Test</span>
In ASP.NET 4 Beta 2, you can set the controlRenderingCompatabilityVersion to “4.0”. In that case, only controls that render input elements will render a disabled attribute when the control’s Enabled property is set to false. Controls that do not render HTML input elements instead render a class attribute that references a CSS class that you can use to define a disabled look for the control. For example, the Label control shown in the earlier example would generate the following markup:
<span id="Label1" class="aspNetDisabled">Test</span>
The default value for the class that specified for this control is “aspNetDisabled”. However, you can change this default value by setting the static DisabledCssClass static property of the WebControl class. For control developers, the behavior to use for a specific control can also be defined using the SupportsDisabledAttribute property.
Posted in: software General | Tags: rendering vsts vs 2010 visual studio css improvement compatibility disabling xhtmlASP.NET MVC improvement in Visual studio 2010
ASP.NET MVC was introduced as an add-on framework to ASP.NET 3.5 SP1 in March 2009. Visual Studio 2010 will include a preview of ASP.NET MVC 2. When Visual Studio 2010 ships, it will include the RTM version of ASP.NET MVC 2. The version of ASP.NET MVC 2 that is included in ASP.NET 4 Beta 2 includes new features and capabilities.
Areas Support
Areas let you group controllers and views into sections of a large application in relative isolation from other sections. Each area can be implemented as a separate ASP.NET MVC project that can then be referenced by the main application. This helps manage complexity when you build a large application and makes it easier for multiple teams to work together on a single application.
Data-Annotation Attribute Validation Support
DataAnnotations attributes let you attach validation logic to a model by using metadata attributes. DataAnnotations attributes were introduced in ASP.NET Dynamic Data in ASP.NET 3.5 SP1. These attributes have been integrated into the default model binder and provide a metadata-driven means to validate user input.
Templated Helpers
Templated helpers let you automatically associate edit and display templates with data types. For example, you can use a template helper to specify that a date-picker UI element is automatically rendered for a System.DateTime value. This is similar to field templates in ASP.NET Dynamic Data.
The Html.EditorFor and Html.DisplayFor helper methods have built-in support for rendering standard data types as well as complex objects with multiple properties. They also support basic customization of rendering by letting you apply data-annotation attributes like DisplayName and ScaffoldColumn to the ViewModel object.
Often you want to customize the output from UI helpers even further and have total control over what is generated. The Html.EditorFor and Html.DisplayFor helper methods support this using a templating mechanism that lets you define external templates that can override and control the output rendered. The templates can be rendered on a per-class basis.
From: http://aspnetmvc.info/wp/2009/09/asp-net-mvc-improvement-in-visual-studio-2010/ Posted in: General asp.net | Tags: .net 4.0 mvc visual studio visual studio 2010 asp.net mvc framework data annotation attribute validation support html.editrofor displayname vewmodelOption Strict On disallows implicit conversions
You may receive an error message that resembles the following when you try to compile a Windows Presentation Foundation (WPF) application in Microsoft Visual Basic 2008:
Option Strict On disallows implicit conversions from 'System.Windows.Application' to 'WpfApplication1.Application'.
This issue occurs if the value of the Option Strict statement is "On" at the project level.
To resolve this issue, download an updated WPF template. To obtain the updated template, visit the following Microsoft Web site:
http://go.microsoft.com/fwlink/?LinkId=105130 (http://go.microsoft.com/fwlink/?LinkId=105130)
Important You do not have to unzip the compressed file with a .zip file name extension to install the updated template. To install the updated template, put the .compressed file with a .zip file name extension in the \Visual Studio 2008\Templates\ProjectTemplates\Visual Basic folder, and then restart Visual Studio 2008.
After you install the updated template, the updated template appears in the New Project dialog box in the My Templates section. This section is located under the Visual Studio installed templates section.