ASP.NET 4.0 Snippet
This is new addition to the multi part post on upcoming .Net 4.0. Recently Microsoft has released the Beta 1 of .Net 4.0 and the Visual Studio 2010, you can get full update on this and how to download & install from this Video by Brian Keller.
This post we will look in to one of the new option of Visual Studio 2010 for ASP.NET 4.0. We were using the code snippets in the visual studio for some time now, and with this release of the Visual Studio 2010 it has been expanded to the ASP.NET 4.0 and HTML as well. Earlier version it was limited to the C# and other languages only.
The working of snippet is no different than the C# & other language codes, all the pre defined ASP.NET snippets are placed in the folder location C:\Program Files\Microsoft Visual Studio 10.0\Web\Snippets\HTML\1033\ASP.NET
and the HTML snippets reside in the folder C:\Program Files\Microsoft Visual Studio 10.0\Web\Snippets\HTML\1033\HTML . Below I have defined a snippet for GridView, once you defined the snippet, use the Tools-> Code Snippet Manager of Visual Studio and Import the Snippet and it will be available for the immediate use.
Snippet for the Grid View
Once Import just type in the Shortcut text for the snippet and hit Tab Tab. You snippet will be inserted to the code as below and you can change the Parameters that are defined in the snippet, in my case I have defined the parameter for ID and DataSourceID attribute.