Converting HTML Server Controls to HTML Elements
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

Converting HTML Server Controls to HTML Elements

Visual Studio .NET 2003

If you no longer need to program an HTML server control in server code, you should convert it back to a plain HTML element. Each HTML server control in a form uses resources, so it is a good practice to minimize the number of controls that the Web Forms page has to work with.

To convert an HTML server control to an HTML element

  • In Design view or in the Document Outline window, right-click the control and clear the check mark next to Run As Server Control.

You can also perform the conversion by editing HTML directly.

To convert an HTML server control to a HTML element using ASP.NET syntax

  • In HTML view, remove the attribute runat="server" from the control's tag.

    You do not have to remove the ID attribute. You want to be especially careful not to remove the ID attribute if there is client script that references the element.

See Also

Adding Controls to a Web Forms Page Programmatically | Adding HTML Server Controls to a Web Forms Page | Creating Event Handlers in Web Forms Pages | Setting HTML Server Control Properties Programmatically | Web Forms Validation | ASP.NET Server Controls

Show:
© 2016 Microsoft