asp.net.ph

HtmlGenericControl.TagName Property

System.Web.UI.HtmlControls Namespace   HtmlGenericControl Class


Sets or retrieves the tag name of an element that contains a runat="server" attribute.

Syntax


Script HtmlGenericControl.TagName = strTagName ]

This property can only be used programmatically; it cannot be set when declaring the control.

Property Value


strTagName String that represents an HTML element name.

The property is read/write with no default value.

Remarks

Use this property to dynamically change the tag name of a generic control on the Web page.

For a <span id="mySpan" runat="server"/> tag, this property would return a value of span.

Example

The below code shows how to use the TagName property to programmatically change a tag name from Body to Font and back.

<script language="C#" runat="server">
   void chgBodyColor ( object src, EventArgs e ) {
      Body.Attributes [ "bgcolor" ] = colorSelect.Value;
   }

   void chgFontColor ( object src, EventArgs e ) {
      Body.TagName="Font";
      Body.Attributes [ "Color" ] = colorSelect.Value;
   }
</script>
  C# VB JScript

 Show me 

See Also

HtmlGenericControl Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph