Last post Oct 17, 2008 09:51 AM by benjib98
Oct 15, 2008 11:25 AM|Slimfinger|LINK
I've created a control that basically consists of a dynamic table, living inside a static panel. I simply wish the table to resize itself upon postbacks, etc., and the panel to display the table, using scrollbars if necessary.
I do not want the cells to "shrink" to fit the panel. This, however, is exactly what happens no matter what I do (but only horizontally???). If I add an item that is wide enough that it would cause the table to grow beyond the panel width, table cells
are shrunk horizontally and the data is extended vertically instead. So the panel scrolls only up and down. (Please do not assume that I have told it to only do this, but for some reason bother to come here and ask this question.)
Similarly, is there some way to guarantee that certain columns are a "minimum width", no matter what? E.g., if I set the TableCell.Width to X pixels, IE7 adheres to this size (except when the total table width is larger than the parent), and Firefox outright
ignores it and always makes the cell as small as possible.
Oct 17, 2008 06:24 AM|benjib98|LINK
Where do you set the Width in your control?I have a similar custom control, where the layout is done using asp:Table. Try to set the Width at the top level, that is at every asp:Table level only in your control. Also about the shrinking, if you have an
empty TableCell always inject a " " non-breaking space when you rendering your conrol, otherwise one of the browsers (not sure which one from the top pf my head) will shrink that Cell, regardless what was the width attribute
Oct 17, 2008 06:34 AM|Slimfinger|LINK
It is a custom composite control, so the width is set via the TableCell class. It wouldn't surprise me, though, to know there is some hokey b.s. involved where you must set the width at a "higher level", etc. My brief incursion into web programming has
disgusted me, as it's replete with hacks and piss-poor architecture. Since it is a custom control, all the cells are declared within, and I cannot touch them in the way you suggest.
As far as the cells "shrinking" in Firefox - they are not empty. Firefox just shrinks them, for the hell of it. I suspect the key (to both problems) has to do with whatever reason the table is not allowed to exceed the panel width (but exceeding the height
is ok! Haha.).
Oct 17, 2008 07:13 AM|benjib98|LINK
Just a quick response: do you have by any chance a CSS setting on your table container/table cell??The overflow(overflow-x, overflow-y) attribute can have ceratin width layout result on such a table, especially if you define a fix width for the panel where
your control resides.Try to set an style="overflow:visible;" property on your table
Oct 17, 2008 09:08 AM|Slimfinger|LINK
Yes, I've tried every contortion of css, asp, and c# methods imagineable. I've tried various "overflow" settings. I've removed all CSS. Etc., etc.
I think I may have finally figured at least part of it out. I have the panel declared as "position: absolute". Changing it to relative makes Firefox happy. The thing is, however, I do not see how this should affect the child table. So the panel is absolutely
positioned (with scrollbars) - why would that prevent a child table from expanding beyond it's borders?
Oct 17, 2008 09:51 AM|benjib98|LINK
Hmm the best thing to do when you create a web custom control, to create the desired layout structure on a clean.aspx page and then following that to create the composite control. I am sure it will be something around the styling, that is CSS as I had many
hours spent on similar problems and turned out to be style settings.