I came across this very insightful post on the ASP.NET Forums (remember those?) about the pitfalls of making a DataGrid scroll. Great stuff. I hadn't even thought of trying points 3 and 4 that way.
4 Comments
I believe your requirements are contradictory:
a) Cross-browser so no client-side stuff
b) the obvious but unstated requirement that headers must line up with columns.
All design is trade-off but I think you can't achieve both (a) and (b) except in a specific limited set of cases (as a minimum fixed column widths, probably specified in pixels, not specified in CSS).
I'd want to add a requirement to hide the scrollbar unless it's needed, which also adds difficulty as the scrollbar width depends on the client PC display settings which are not available to you on the server (OK it's true the majority of users don't change it). And I'd also want to see columns aligned when the page is printed, preferably without the scrollbar.
I think to get an acceptable solution you'd need client-side script, so in many environments (especially Intranet) an htc solution is more likely to give acceptable results.
Since your comments are insightful I will leave them, but I've decided that I'm no longer keeping comments unless the commenter is clearly identified.
Hi. Your online demo isn't working:
"The located assembly's manifest definition with name 'Interscape.CodesideAssistance.ScrollingGrid' does not match the assembly reference. "
Thought this was the best place to let you know. Sorry if it isn't.
No, that's perfect. Thanks for the info, I'll check it out right away.