HtmlTextWriter output varies with browser?

J

Jeff Evans

OK, this one has me totally baffled. Please go to:

http://www.uiucsingles.com/

Notice the left div (class="navDiv"). For some reason the control that
renders this section of the page is outputting different tags to different
browsers, when using HtmlTextWriterAttribute and
HtmlTextWriterTag. For testing purposes, here is how the Render function
looks when the user is not logged in:

output.Write("<div class=\"navDiv\">...</div>");

and when the user IS logged in:

output.AddAttribute(HtmlTextWriterAttribute.Class,"navDiv");
output.RenderBeginTag(HtmlTextWriterTag.Div);
....
output.RenderEndTag();

In theory these should produce the same result. But for some reason, in the
non-IE browsers I tested (Firefox 1.0 and Opera 7.23), the latter case
results in a tag that looks like this:

<table class="navDiv" cellpadding="0" cellspacing="0" border="0"
width="100%"><tr><td>(stuff in the div)</td></tr></table>

It's not just with this control either. Any time I use the TextWriter
attribute/tag write methods with a div, I get the funky table in Firefox and
Opera (check out the header). But to make matters worse, IE always seems to
get the correct tag of:

<div class="navDiv">(stuff in div)</div>

Has anyone encountered anything like this before? I guess if I can't figure
out what is going on I will just manually output the proper tags. Grr...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top