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.
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.