Datagrid not sized for number of items. Trying to use Flow Layout, affecting row height.

Discussion in 'ASP .Net' started by Kat, Oct 20, 2004.

  1. Kat

    Kat Guest

    Hi, I'm trying to set up an asp.net page using flow layout so I'm
    putting all my controls into a table grid, etc. I use several
    radiobuttonlists and datagrids that are generated from datasource. The
    radiobuttonlists are fine, they size depending on how many item are
    called into it.

    However, the datagrids, prior to filling with data contain FIVE
    "Databound" items and the grid does not shrink if it is filled with
    only 2 for example. Therefore, the table row height reflects the five
    "databound" columns and not the dynamically filled datagrid.

    Am I making any sense? I'm simply getting a dataset which is a dollar
    amount, selecting the ItemPrice field in the datagrid's property
    builder, and formatting it {0:c}, binding the dataset to my datagrid.

    Any suggestions as to how I can work around this, or am I simply doing
    something wrong? And, of course, if so -- what?

    Thanks,
    Kat
    Kat, Oct 20, 2004
    #1
    1. Advertising

  2. RE: Datagrid not sized for number of items. Trying to use Flow Layout,

    Kat, not totally sure I understand, but can you just set "visible=false" for
    the columns you don't use?

    Bill

    "Kat" wrote:

    > Hi, I'm trying to set up an asp.net page using flow layout so I'm
    > putting all my controls into a table grid, etc. I use several
    > radiobuttonlists and datagrids that are generated from datasource. The
    > radiobuttonlists are fine, they size depending on how many item are
    > called into it.
    >
    > However, the datagrids, prior to filling with data contain FIVE
    > "Databound" items and the grid does not shrink if it is filled with
    > only 2 for example. Therefore, the table row height reflects the five
    > "databound" columns and not the dynamically filled datagrid.
    >
    > Am I making any sense? I'm simply getting a dataset which is a dollar
    > amount, selecting the ItemPrice field in the datagrid's property
    > builder, and formatting it {0:c}, binding the dataset to my datagrid.
    >
    > Any suggestions as to how I can work around this, or am I simply doing
    > something wrong? And, of course, if so -- what?
    >
    > Thanks,
    > Kat
    >
    =?Utf-8?B?QmlsbCBCb3Jn?=, Oct 20, 2004
    #2
    1. Advertising

  3. Kat,

    Probably you have set the height attribute for the grid to an absolute
    value. You should leave it automatic and then the grid will size itself
    nicely. If you want the grid to look bigger than it is, you can achieve this
    buy setting the grid's container (a cell, div etc.) background color to the
    same color as the grid's background and setting grid's border to 0.

    Eliyahu

    "Kat" <> wrote in message
    news:...
    > Hi, I'm trying to set up an asp.net page using flow layout so I'm
    > putting all my controls into a table grid, etc. I use several
    > radiobuttonlists and datagrids that are generated from datasource. The
    > radiobuttonlists are fine, they size depending on how many item are
    > called into it.
    >
    > However, the datagrids, prior to filling with data contain FIVE
    > "Databound" items and the grid does not shrink if it is filled with
    > only 2 for example. Therefore, the table row height reflects the five
    > "databound" columns and not the dynamically filled datagrid.
    >
    > Am I making any sense? I'm simply getting a dataset which is a dollar
    > amount, selecting the ItemPrice field in the datagrid's property
    > builder, and formatting it {0:c}, binding the dataset to my datagrid.
    >
    > Any suggestions as to how I can work around this, or am I simply doing
    > something wrong? And, of course, if so -- what?
    >
    > Thanks,
    > Kat
    Eliyahu Goldin, Oct 21, 2004
    #3
  4. Kat

    KatB Guest

    After playing with it some more, I think I can explain it more simply...

    An html table row has a datagrid in it.

    I do not set the datagrid control's height.

    The hmtl table row (in the html page) automatically sets its height to
    match that of the empty five-row datagrid, and just comes back when I
    delete the height.

    When the datagrid is empty (no dataset), I set it to visible=false.

    The html row height stays as large as if the datagrid was populated and
    visible...blank but the space is still there.

    Driving me nuts!!!

    Thanks, Kat

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    KatB, Oct 21, 2004
    #4
  5. "KatB" <> wrote in message
    news:%...
    > After playing with it some more, I think I can explain it more simply...
    >
    > An html table row has a datagrid in it.

    You mean an html cell (<td>)

    >
    > I do not set the datagrid control's height.
    >
    > The hmtl table row (in the html page) automatically sets its height to
    > match that of the empty five-row datagrid, and just comes back when I
    > delete the height.

    The row height is calcilated automatically to accomodate the cell content.
    How can an empty datagrid be five-row one? If it has no rows and the height
    is not set it should have the height of the header (plus the borders,
    paddings, margins), no room should be allocated for empty rows. What do you
    mean by "delete the height"? Did not you say you didn't set the datagrid
    height?

    >
    > When the datagrid is empty (no dataset), I set it to visible=false.
    >
    > The html row height stays as large as if the datagrid was populated and
    > visible...blank but the space is still there.
    >
    > Driving me nuts!!!
    >
    > Thanks, Kat
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Eliyahu Goldin, Oct 21, 2004
    #5
  6. Kat

    KatB Guest

    Resolved. I hadn't realized that every time I touched the datagrid in
    design view, it automatically put back a height measurement in the HMTL.
    Every datagrid I have is a five-row list of DataBound, DataBound, etc.
    So initially, the HTML was calculating on that.

    I went back and removed EVERY height attribute in my HTML tables and all
    is well.

    Thanks for your help!


    Thanks, Kat

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    KatB, Oct 21, 2004
    #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. RobertH
    Replies:
    1
    Views:
    710
    Steve C. Orr [MVP, MCSD]
    Nov 4, 2003
  2. NWx
    Replies:
    4
    Views:
    2,951
    Kevin Spencer
    Feb 19, 2004
  3. thechaosengine

    Oddly sized sized password textbox

    thechaosengine, Sep 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    571
    David Hearn
    Sep 15, 2005
  4. Andrew Chalk

    Flow layout to grid layout

    Andrew Chalk, Dec 23, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    538
    Andrew Chalk
    Dec 23, 2005
  5. Andre Ranieri

    Datagrid row height changes depending on number of items?

    Andre Ranieri, Dec 2, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    155
    Andre Ranieri
    Dec 3, 2003
Loading...

Share This Page