ASP.NET 2.0, it seems to wrap a div around the hidden form fields

Discussion in 'ASP .Net' started by Thor W Hammer, Nov 9, 2005.

  1. In ASP.NET 2.0, it seems to wrap a div around the hidden form fields such as
    __ViewState. How do you override this rendering?
     
    Thor W Hammer, Nov 9, 2005
    #1
    1. Advertising

  2. Thor W Hammer

    Bruce Barker Guest

    please report it as a bug if enough of us do, maybe MS will fix it (it
    causes all kinds of layout problems).

    the only fix is a post processing httphandler that strips the divs out. i
    haven't written one yet, but i'm close.


    -- bruce (sqlwork.com)



    "Thor W Hammer" <> wrote in message
    news:437146df$...
    > In ASP.NET 2.0, it seems to wrap a div around the hidden form fields such
    > as
    > __ViewState. How do you override this rendering?
    >
    >
     
    Bruce Barker, Nov 9, 2005
    #2
    1. Advertising

  3. Thor W Hammer

    Greg Burns Guest

    http://www.aspnetpro.com/newsletterarticle/2005/11/asp200511de_l/asp200511de_l.asp

    "ASP.NET 2.0 defaults to XHTML 1.1, but you can also opt for XHTML 1.0
    Strict or Transitional. The rendering engine of some controls has been
    reworked to make them produce compliant output. As a result, in ASP.NET 2.0,
    each control's markup includes a closing tag. Furthermore, the viewstate
    hidden field comes surrounded by a <div> tag and the form is only identified
    by the ID attribute."

    Sounds like they did this for a reason.

    Greg


    "Bruce Barker" <> wrote in message
    news:...
    > please report it as a bug if enough of us do, maybe MS will fix it (it
    > causes all kinds of layout problems).
    >
    > the only fix is a post processing httphandler that strips the divs out. i
    > haven't written one yet, but i'm close.
    >
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    > "Thor W Hammer" <> wrote in message
    > news:437146df$...
    >> In ASP.NET 2.0, it seems to wrap a div around the hidden form fields such
    >> as
    >> __ViewState. How do you override this rendering?
    >>
    >>

    >
    >
     
    Greg Burns, Nov 9, 2005
    #3
  4. On Wed, 9 Nov 2005 01:46:21 +0100, Thor W Hammer wrote:

    > In ASP.NET 2.0, it seems to wrap a div around the hidden form fields such as
    > __ViewState. How do you override this rendering?


    Viewstate is enclosed in a DIV because that's required to produce valid
    XHTML markup. inline elements (ie, input fields) must be enclosed in a
    block level element in order to be valid.
     
    Erik Funkenbusch, Nov 9, 2005
    #4
  5. Thor W Hammer

    intrader Guest

    On Tue, 08 Nov 2005 21:03:47 -0500, Greg Burns wrote:

    > http://www.aspnetpro.com/newsletterarticle/2005/11/asp200511de_l/asp200511de_l.asp
    >
    > "ASP.NET 2.0 defaults to XHTML 1.1, but you can also opt for XHTML 1.0
    > Strict or Transitional. The rendering engine of some controls has been
    > reworked to make them produce compliant output. As a result, in ASP.NET 2.0,
    > each control's markup includes a closing tag. Furthermore, the viewstate
    > hidden field comes surrounded by a <div> tag and the form is only identified
    > by the ID attribute."
    >
    > Sounds like they did this for a reason.
    >
    > Greg
    >
    >
    > "Bruce Barker" <> wrote in message
    > news:...
    >> please report it as a bug if enough of us do, maybe MS will fix it (it
    >> causes all kinds of layout problems).
    >>
    >> the only fix is a post processing httphandler that strips the divs out. i
    >> haven't written one yet, but i'm close.
    >>
    >>
    >> -- bruce (sqlwork.com)
    >>
    >>
    >>
    >> "Thor W Hammer" <> wrote in message
    >> news:437146df$...
    >>> In ASP.NET 2.0, it seems to wrap a div around the hidden form fields such
    >>> as
    >>> __ViewState. How do you override this rendering?
    >>>
    >>>

    >>
    >>

    It seems to me that the XTHML schema allows hidden fields inside form
    elements. So why do we need the div?. Check the generated (rendered)
    XHTML and verify that the div is there. I have seen posts that indicate
    that the div is not there, but that some controls are followed by a
    carriage return. This carriage return would be ignored by any good
    browser.
    It will definetelly create layout problems as it is a block
    element. So is this a problem with ASP.NET 2.0?
     
    intrader, Nov 10, 2005
    #5
  6. On Thu, 10 Nov 2005 02:31:10 GMT, intrader wrote:

    > On Tue, 08 Nov 2005 21:03:47 -0500, Greg Burns wrote:
    > It seems to me that the XTHML schema allows hidden fields inside form
    > elements. So why do we need the div?


    No. While it's true that hidden fields have to be inside form elements to
    be posted, it has nothing to do with form elements per se. The problem is
    that input elements are inline elements, and inline elements must be
    contained in block elements.
     
    Erik Funkenbusch, Nov 10, 2005
    #6
    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. Rocky Moore

    DIV wrapped around hidden fields?

    Rocky Moore, Oct 17, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    547
    Alan Silver
    Nov 3, 2005
  2. Aaron Fude

    To wrap or not to wrap?

    Aaron Fude, May 8, 2008, in forum: Java
    Replies:
    12
    Views:
    709
    Chronic Philharmonic
    May 10, 2008
  3. Replies:
    0
    Views:
    292
  4. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 22, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    237
    Art Werschulz
    Sep 22, 2003
  5. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 24, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    250
    Anno Siegel
    Sep 25, 2003
Loading...

Share This Page