Extract To User Control in Visual Studio 2011 Developer Preview

This is very handy and quick time saving features and a much required during code refactoring. Consider a situation where you have designed some web pages which are quite large or you have realized that it would have been better to put some part of web page in a user control  so that you can use it  in multiple places. Yes,  manually this is a big process  to create controls, copy – past code and refer them in page.

Well, VS 2011 Developer preview  makes this very easier. In source of HTML Editor you will have option called “Extract to User Control .  Select the code block in HTML Editor which you want to move as user control and select “Extract to User Control” from context menu.

image

This will launch “Save As” dialog for user control. Provide the “User Control Name” and click “Ok”

image

This will automatically create a User Control and same will be referred to your page automatically.

image

Interesting ? Well, you can check out few more interesting addition over here Few Nice features in Visual Studio 11 Developer Preview for ASP.NET Developers

Hope this helps !

Cheers !

Abhijit

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.