Last post Dec 28, 2009 06:31 AM by Prathamesh2009
Dec 24, 2009 06:55 AM|Prathamesh2009|LINK
Is there any way to change render type of <p> to <span>?
Or change render type of <span> to <div>.
I have an idea about override RenderBeginTag, apart from this is there any other way to do this. Any suggestion client side or server side will appreciate.
asp .net 3.5
Dec 24, 2009 02:09 PM|jkirkerx|LINK
I remember when I first started out, I had some tags that were being changed at render. Had to do with the render call. But then I discovered that if I just made use of the asp.net controls, the tags always rendered correctly.
A <span> tag is the label control
The <div> tag is the panel control.
To make a <div> tag
Dim panel_Control As Panel
panel_Control = New Panel
.Width = [Width]
.style.add(HtmlTextWriterStyle.Margin, "0px auto")
So to make a span tag in vb and add it to the panel
Dim lbl_Title as Label
lbl_Title = New Label
.Text = "Hey"
To make a <p> tag, use the literal control
Dim lit_Paragraph As LiteralControl
lit_Paragraph = new LiteralControl
.Text = "<p class=""SalesText"" style=""margin: 10px;"">" _
"This is my message.</p>"
Dec 27, 2009 12:30 PM|TATWORTH|LINK
Please see the XHTMLFix project at
In such as:
/// Initializes the <see cref="T:System.Web.UI.HtmlTextWriter"/> object and calls on the child controls of the <see cref="T:System.Web.UI.Page"/> to render.
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> that receives the page content.</param>
/// This routine can be used in base class.
protected override void Render(HtmlTextWriter writer)
var sb = new StringBuilder();
var sw = new StringWriter(sb, CultureInfo.InvariantCulture);
var testWriter = new HtmlTextWriter(sw);
var pageResult = sb.ToString().Replace("<span disabled=\"disabled\"", "<span");
The rendered HTML is post-processed to fix problems that otherwise would render the page non XHTML compliant. You can adapt that technique.
Dec 28, 2009 06:31 AM|Prathamesh2009|LINK
Thanks for your help.