Unnecessary spaces when rendering list controls

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, Jan 29, 2009.

  1. When a DropDownList is rendered, the <option> tags are all rendered on
    separate lines, as follows:

    <option value="mon">Monday</option>
    <option value="tues">Tuesday</option>
    <option value="wed">Wednesday</option>
    <option value="thur">Thursday</option>
    <option value="fri">Friday</option>

    Notice that each <option> tag is not only on its own line, but is indented
    as well. Why is this extra space rendered? It increases the download size of
    the page (maybe only a little, but if a page has a lot of DropDownLists with
    a lot of options, such as a page with multiple DropDownLists for states, it
    can be a lot) for no reason (at least not that I know of). Is there any easy
    way to avoid this extra space? I'm not trying to complain, I just don't see
    the point in increasing download size for no reason.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Jan 29, 2009
    #1
    1. Advertising

  2. Nathan Sokalski

    Carlo Pagano Guest

    Excellent question, I've been looking into this and I can't understand why
    such "overhead" is introduced. I have a project which has a bunch of
    dropdownlists on a certain page and the increased download size is ridiculous.

    "Nathan Sokalski" wrote:

    > When a DropDownList is rendered, the <option> tags are all rendered on
    > separate lines, as follows:
    >
    > <option value="mon">Monday</option>
    > <option value="tues">Tuesday</option>
    > <option value="wed">Wednesday</option>
    > <option value="thur">Thursday</option>
    > <option value="fri">Friday</option>
    >
    > Notice that each <option> tag is not only on its own line, but is indented
    > as well. Why is this extra space rendered? It increases the download size of
    > the page (maybe only a little, but if a page has a lot of DropDownLists with
    > a lot of options, such as a page with multiple DropDownLists for states, it
    > can be a lot) for no reason (at least not that I know of). Is there any easy
    > way to avoid this extra space? I'm not trying to complain, I just don't see
    > the point in increasing download size for no reason.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
    >
    >
     
    Carlo Pagano, Feb 25, 2009
    #2
    1. Advertising

  3. Nathan Sokalski

    JM Guest

    > I'm not trying to complain, I just don't see the point in increasing
    > download size for no reason.


    Quite simply human readability.

    The parser processing the page could care less..

    John
     
    JM, Mar 31, 2009
    #3
  4. In the case of most controls that render multiple tags (which I realize is a
    large percentage of them) I would agree, but for a simple
    <select><li></li></select>, for example (with multiple li's, of course),
    it's not that hard to read since thare are rarely any nested tags. Also, if
    human readability is the issue, you still don't need to indent them, just
    put them on separate lines. For most tags (where there is just an opening
    and closing, possibly with nested, and the opening/closing may be many lines
    apart), indentation may be more important for human readability. And there
    is no reason there couldn't be a property in the base list class that allows
    you to choose.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "JM" <> wrote in message
    news:...
    >> I'm not trying to complain, I just don't see the point in increasing
    >> download size for no reason.

    >
    > Quite simply human readability.
    >
    > The parser processing the page could care less..
    >
    > John
    >
     
    Nathan Sokalski, Apr 1, 2009
    #4
    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. John B. Matthews
    Replies:
    4
    Views:
    684
    John B. Matthews
    Sep 12, 2008
  2. Roedy Green
    Replies:
    3
    Views:
    646
  3. Tomasz Chmielewski

    [CSS] how can I show spaces as spaces?

    Tomasz Chmielewski, Sep 5, 2009, in forum: HTML
    Replies:
    21
    Views:
    1,660
    Jan C. Faerber
    Sep 10, 2009
  4. Tomasz Chmielewski

    how can I show spaces as spaces, part 2

    Tomasz Chmielewski, Sep 9, 2009, in forum: HTML
    Replies:
    14
    Views:
    905
    Jan C. Faerber
    Sep 10, 2009
  5. johkar
    Replies:
    2
    Views:
    3,002
    Mayeul
    Dec 10, 2009
Loading...

Share This Page