I hear ya. The kit's GridView sample page, http://www.asp.net/cssadapters/gridview.aspx, exhibits the behavior that you are describing if you make the browser window narrow enough. You'll find that the table has a "natural" minimum width that is wider than the min width of the <div> tags that are used for pagination. As you described, those pagination <div> tags typically live above or below (or both) the <table> that is the grid of data being shown.
So you need to figure out a way, in CSS, to "tell" the page not to let the pagination regions become narrower than the sibling table. With me so far?
One solution is to try to set a minimum width for the parent element of both the pagination and the table regions. With the adapters in play, you get a div that looks like this:
<div class="AspNet-GridView">
It's the parent of both the table and the pagination div. So you want to effectively want:
div.AspNet-GridView
{
min-width: 30em;
}
Obviously the 30em width value is a placeholder. You would set it correctly for your situation.
Of course, it's not that simple because IE6 doesn't recognize min-width (I'm not sure whether or not IE6 does). So you have to tell IE what to do. It turns out that "width" in IE6 (not sure about IE7) is actually treated like min-width so you can do things like this:
div.AspNet-GridView
{
min-width: 30em;
_width: 30em;
}
Then what happens is that IE6 picks up the _width (because IE6 ignores the leading underscore) but the _width is ignored by other browsers (Gecko, etc.) which do recognize the min-width (which IE ignores). Still with me? Ha ha.
OK, the problem with _width is that it's pretty hacky. I don't like it, frankly, though I admit I've used it in the past. I guess I'm a reformed sinner.
Now, I tend to use conditional comments to add <link> tags where I add IE6-only or IE7-only rules. So I would have a general rule like this:
div.AspNet-GridView
{
min-width: 30em;
}
And I would have the exact same selector in IE6-only and/or IE7-only style sheet that looks like this:
div.AspNet-GridView
{
width: 30em;
}
Note that I'm not using the underscore here because I don't need the hack. The IE6 or IE7 style sheet will only get used when the browser is actually IE6 or IE7 so I don't need to mess around with the name of the property in the CSS rule. Nice.
Thoughts?
Russ Helfand
Groovybits.com