ASP.NET 4.5 Features - Key HTML Editor Features

With the release of ASP.NET 4.5, we have seen many new enhancements in HTML. Today, we will be go through the key HTML editor features introduced in ASP.NET 4.5.

The following are the most important / productive enhancements introduced in HTML with ASP.NET 4.5:

  • Smart Tasks
  • Extract to User Control
  • HTML5 Snippets
  • Automatic Renaming of matching tag
  • Event Handler Generation

Automatic Renaming of the matching tag

In ASP.NET 4.5, we have a very productive feature where matching tags are automatically renamed when we change the opening tag.

Consider the following code in HTML side

NewFeature_1.png

Now in earlier versions of ASP.NET if I had to make a change in the starting tag then I had to manually update the end tag too. However, with ASP.NET 4.5, you will see that if you update the starting tag then the end tag will also update automatically.

Please see the following image for more details.

NewFeature_2.png

Extract to User Control

The ASP.NET 4.5 desiners have developed a very unique and productive feature where at any point of time, we can change code present in a web form to a user control.

Consider I have a web form containing TextBoxes for userName and Password for authentication. While working on this page, we found that we need this user name and password authentication in various modules of the project.

NewFeature_3.png

With this said, ASP.NET 4.5 provides us the great feature where we must simply select the code and we can change that selected code to a User Control; see:

NewFeature_4.png

Smart Task in HTML Editor

One of the productive features added to ASP.NET a few years back was the addition of a smart task. On the click of the smart available on the control, you can accomplish some of the common tasks on that control.

NewFeature_5.png

Now with ASP.NET 4.5, we have the same feature while working on the HTML side. Hence, we don't need to go to design mode to use this feature.

NewFeature_6.png

If you click on the line present under "a" , this would open up the smart task for that control.

NewFeature_7.png

You will see that you can perform all the common tasks for that control.

Code Snippets in HTML

With ASP.NET 4.5, we have code snippets available in HTML.

If you want to add audio or video to you page then you simply must type video on HTML and press TAB twice. You will see that full audio / video control is available, mentioning all the common properties.

NewFeature_8.png

Event Handler generation

Before the release of ASP.NET 4.5, if we must create any event handler for any control then we either must double-click on that control, that will generate an event for that control or define the event in the properties of that control. However, with ASP.NET 4.56 we have a new property added in the control, where we can generate an event for the control at the HTML side and we don't need to switch to design mode.

NewFeature_9.png

Clicking on "Create New Event" will create a default event for that control; however we can provide any name of that event and you would see that Visual Studio will then automatically generate the appropriate server side event handler within your code behind file for you.

NewFeature_11.png

Hope this article of mine has been helpful in giving some knowledge of the new features of ASP.NET 4.5.

Please visit my blog http://varunkhanna.blogspot.com/ for more articles.

Up Next
    Ebook Download
    View all
    Learn
    View all