.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Why to modify control code snippet? How to modify code snippet for control?

Posted By:shankey       Posted Date: April 22, 2011    Points: 200    Category: .Net Framework    URL: http://www.dotnetspark.com  

Why to modify control code snippet? How to modify code snippet for control?
 

Why to modify control code snippet?

Following are some reason to modify the control code snippet

  1. Want some Hungarian notation  or prefix for controls. Then it can be set in the code snippet. There is no need to type txt in "txtArea" , chk in "chkAllow", opt in "optMale" etc.
  2. Want some properties to appear when the control is created. Like runat="server" etc.

How to modify code snippet for control?

Step1: Open visual studio 2010

 In Visual studio 2010, Select Tool from menu bar and then select "Code snippets Manager". This will open code snippet manager dialog box.

Step2: Code snippet manager dialog box

In code snippet manager select "HTML" as language. And then expand ASP.NET node displayed in the left pane.

Select checkbox item under the "ASP.NET" node and copy the path displayed besides the "Location" label.

Step3: Open "Run" window from startup

In run paste the paths copied in the previous step

Press enter and the requested snippet will be opened in visual studio. (You can open it in any IDE) Select "NO" when following popup appears.

 Step4:Edit the snippet

Edited the snippet (Edited section is highlighted with a box)

Step5: Create new project/solution

Open the .aspx page of the new project as show below.

Type "check" and intellisense will appear, select "checkbox" and then press tab twice

Finally when you will insert the checkbox using snippet then always modified control will be created.

Same way I modified the snippet for textbox and inserted textbox using insert snippet. As shown below

\

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend