Karl said:
I believe you want to look at overriding the RenderBeginTag and RenderEndTag
methods...
public override void RenderBeginTag(HtmlTextWriter writer)
{
writer.Write("<div>");
}
Hi,
That is exactly what I wanted. However I am having a problem. I am
using the following code:
' RenderBeginTag
Public Overloads Overrides Sub RenderBeginTag(ByVal writer As
HtmlTextWriter)
' Write writer content
writer.RenderBeginTag(HtmlTextWriterTag.Div)
' Add writer attributes
writer.AddAttribute("id", Me.ID)
writer.AddAttribute("class", Me.CssClass)
writer.AddAttribute("width", Me.Width.ToString)
End Sub ' RenderBeginTag
What is strange is that the attributes are not being applied to this
<div> but to a <div> which is generated by a Panel which being added as
a child control of my custom control.
What am I doing wrong?
And by the way, why does a custom control uses <span> as default render
wrapper tag?
This is quite strange as Panel is rendered as <div>. So if I use a
Panel in a custom control which might be quite normal I will have
problems as a <div> can't be placed inside a <span>
Check:
http://www.cs.tut.fi/~jkorpela/html/nesting.html
Thanks,
Miguel