Add a custom ASP.NET control to a page

Before you can work with a custom ASP.NET control in a page in Microsoft Expression Web, you need to make the custom control available to Expression Web and reference the custom control in either your web page or the web.config file of your website. For information, see Add a custom ASP.NET control to a website and Add a custom ASP.NET control to a page.

You can add a custom control to an ASP.NET page and work with it like any other ASP.NET control. Custom ASP.NET controls do not appear in the Toolbox task pane or the Insert menu, so you need to use the Code view of a page to add a custom control.

To add a custom ASP.NET control to a page:

  1. Open your ASP.NET page in Code or Split view.

  2. In the code pane, place your cursor where you want the control to reside between the <body> and </body> tags, and then do one of the following:

    • Type < and then select the custom control tagprefix:nameofclass from the IntelliSense shortcut menu.

      To add an attribute to the control, press SPACEBAR, and then in the IntelliSense shortcut menu, select the property. In the IntelliSense shortcut menu, select a value.

      Repeat this step to add more properties.

    • Type the following code:

      <TAG_PREFIX:CLASS_NAME runat="server" />
      

      Replace TAG_PREFIX with the value specified for TagPrefix in either the register directive in the page or the web.config file for the website; and replace CLASS_NAME with the class name of the custom control.

      The custom control may require other properties and event handlers to function properly; for more information, contact the developer of your custom control.

See also

Concepts

Custom ASP.NET controls

Add a custom ASP.NET control to a website

Reference a custom ASP.NET control