can anyone tell me if it is possible to extend the ASP.NET HtmlTextWriterTag Enum so that it includes HTML 5 tags? Specifically 'section' and aside' tags at the moment.
I'm trying to create a control which inherits from the Panel Control, but instead of it writing a tag I want it to write either a an 'aside' tag or a 'section' tag dependent on a property on the control.
I'm stuck using Web forms and VB.NET, so if the solution could take that into account it'd be appreciated.
If there is another (easier) way of doing this, please let me know.
[EDIT]
In the past I have changed the outer HTML tag of a panel by using the following code (this would render 'li' tags instead of a 'div' tag):
Protected Overrides ReadOnly Property TagKey() As System.Web.UI.HtmlTextWriterTag
Get
Return HtmlTextWriterTag.Li
End Get
End Property
I'm struggling to make this render a as a 'section' or an 'aside' tag though. I can get the control to render...
<div>
<section>
</section>
<div>
...but the perfectionist in me just wants to render...
<section开发者_运维百科>
</section>
You can't extend any enum, ever.
You can create a new enum that contains the HTML5 tags, but then you'd also have to create an Html5TextWriter that has Write methods that accept parameters of the new type.
精彩评论