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

K

Kat

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
 
G

Guest

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

Bill
 
E

Eliyahu Goldin

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
 
K

KatB

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
 
E

Eliyahu Goldin

KatB said:
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 ( said:
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?
 
K

KatB

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
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top