Note: This post will be part of Visual Studio 2012 feature series. As Visual studio 2011 beta is now known as Visual Studio 2012I have been playing with Visual Studio 11 beta recently and everyday I am amazed with new features of it. Today I have found one more very useful feature Extract to User Control feature.
In large projects, we are having large pages and its always good to use user control(.ascx) but sometimes we are so lazy to create user controls and we remain with the whole page and even we can’t reuse that code. In similar kind of situation ‘Extract to user control’ can be quite useful. Suppose we have long HTML mark up and we need to convert one div to user control and then we can do it very easily with Visual Studio 11 beta Extract to User Control feature.
You just need to select code you want there in user control and then you need to right click and click ‘Extract to User Control’ like below.
And once you click on ‘Extract to User Control’ It will ask to save your user control with save dialog like following.
Once you click ok a new user control will be like following.
And now your mark up in default.aspx page will look like following.
So it will do all this things automatically. It’s a really cool feature and will make our life more easy. That’s it for now. Hope you like it. Stay tuned for more updates. Till then happy programming!!