I have three divs: two have a set width, and the third div contains a gridview that can change in size. In other words, the gridview can have any amount of columns, but each column must be 200px wide.
In this example, the gridview has 7 columns at 200px width each. My screen is 1366x768, and 460px (300px+160px) is already taken up by two divs. The remaining space cannot display the 1400px gridview (7 cols x 200px). So it moves the third div to the bottom.
I need to display GridViewClicks next to the first two divs, and show a horizontal scrollbar once the gridview width is greater than the available space. Each gridview column needs to be 200px each.
I've tried tons of CSS properties, but none of them have worked. It either shrinks the columns or it repositions the div below the other two.
Any help is appreciated. I've posted a complete example showing the issue; you just need to copy/paste.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
The issue is that you're setting a width for the gridview and the surrounding div. I don't want to set widths for either of these since I don't know what resolution the users have.
Member
37 Points
559 Posts
Div with gridview not displaying horizontal scrollbar
Apr 15, 2017 02:21 PM|vmhatup|LINK
I have three divs: two have a set width, and the third div contains a gridview that can change in size. In other words, the gridview can have any amount of columns, but each column must be 200px wide.
In this example, the gridview has 7 columns at 200px width each. My screen is 1366x768, and 460px (300px+160px) is already taken up by two divs. The remaining space cannot display the 1400px gridview (7 cols x 200px). So it moves the third div to the bottom.
I need to display GridViewClicks next to the first two divs, and show a horizontal scrollbar once the gridview width is greater than the available space. Each gridview column needs to be 200px each.
I've tried tons of CSS properties, but none of them have worked. It either shrinks the columns or it repositions the div below the other two.
Any help is appreciated. I've posted a complete example showing the issue; you just need to copy/paste.
And this is the codebehind. As you can see, the datatable has 7 columns so the gridview has 7 columns, each with a width of 200px each:
Star
8650 Points
2882 Posts
Re: Div with gridview not displaying horizontal scrollbar
Apr 17, 2017 06:23 AM|Cathy Zou|LINK
Hi vmhatup,
For your problem, I suggest you could use the following code:
Codebehind not change:
Output screenshot asbelow:
Best regards
Cathy
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
37 Points
559 Posts
Re: Div with gridview not displaying horizontal scrollbar
Apr 17, 2017 01:14 PM|vmhatup|LINK
The issue is that you're setting a width for the gridview and the surrounding div. I don't want to set widths for either of these since I don't know what resolution the users have.