save up to 40%

How to convert a Web page to a user control by using Visual Studio 2005?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

How to convert a Web page to a user control by using Visual Studio 2005?

Rating:

The following are the steps to convert a Web page to a user control by using Visual Studio 2005:

  1. Open the existing Web page named MyWebForm1.aspx. Add the Web server controls, which will serve as common functionality to all other Web pages of the Web site name MyWebsite1, as shown below:



  2. Click the Source tab of the MyWebForm1.aspx page to view the code written for the Web page, as shown below:



  3. Delete the <html>, <!doctype>, <head>, <body>, and <form> tags from the MyWebForm1.aspx source file, as shown below:



  4. Change the @ Page directive type to the @ Control directive type. Change the CodeFile attribute name from MyWebForm1.aspx.vb to WebUserControl1.ascx.vb. Change the Inherits attribute, as shown below:



  5. Open the source code of the MyWebForm1.aspx.vb file, as shown below:



  6. Change the base class from System.Web.UI.Page to System.Web.UI.UserControl. Change the public class declaration from MyWebForm1 to WebUserControl1. Save and close both the .aspx and the .aspx.vb files. An illustrative image is shown below:



  7. Open the Solution Explorer to view all the Web files of the Web site. Right-click the MyWebForm1.aspx file and select the Rename option on the shortcut menu, as shown below:



  8. Now the MyWebForm1.aspx page is changed to the WebUserControl1.ascx file. The file is now become a Web user control, and is ready to be rendered to other Web pages of the Web site. An illustrative image is shown below:


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.