Monday, September 30, 2013

Extract to User Control in visual studio11



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.

Extract to user control feature- What's new in visual studio 11 features


And once you click on ‘Extract to User Control’ It will ask to save your user control with save dialog like following.

Extract to user control feature save dialog visual studio 11 feature series

Once you click ok a new user control will be like following.

Extarct to User control- Extracted user control in visual studio 11

And now your mark up in default.aspx page will look like following.

extract to user control visual studio 11 aspx page

No comments:

Post a Comment

Thank you for visiting my blog

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...