HtmlTextWriter output varies with browser?

Discussion in 'ASP .Net' started by Jeff Evans, Dec 4, 2004.

  1. Jeff Evans

    Jeff Evans Guest

    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...
    Jeff Evans, Dec 4, 2004
    #1
    1. Advertising

  2. Jeff Evans

    Jeff Evans Guest

    Jeff Evans, Dec 4, 2004
    #2
    1. Advertising

  3. Jeff Evans

    Jeff Evans Guest

    Jeff Evans, Dec 5, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rukmal Fernando
    Replies:
    0
    Views:
    954
    Rukmal Fernando
    Oct 3, 2003
  2. David M. Wilson
    Replies:
    1
    Views:
    619
    Donn Cave
    Mar 5, 2004
  3. Kevin Frey
    Replies:
    0
    Views:
    428
    Kevin Frey
    Nov 19, 2006
  4. Replies:
    9
    Views:
    319
    Peter Pearson
    Apr 4, 2009
  5. Chris Nelder

    Request.Form.Count varies by machine?!

    Chris Nelder, Jul 30, 2003, in forum: ASP General
    Replies:
    1
    Views:
    117
    Ray at
    Jul 30, 2003
Loading...

Share This Page