ASp.Net Gridview wider than parent DIV
Issue page: http: // www. webeerlieve. com / ShowThread.aspx? ID = 521
If you put your browser at 1024x768, you will see the GridView going through the "postbody" div. I don't know how to stop this.
Due to the nature of the table, the minimum width cannot be dropped below, and the width is determined by the width of the elements in each row of the table. I assume you have already specified the width of the GridView and are still overflowing because the data is too large. You can try adding the GridView to another div and specify css properties for that div to control overflow, like this:
<div style="overflow: scroll; width: 800px; Height: 300px;">
<asp:GridView id="GridView1" runat="server" />
</div>
Now, if your GridView exceeds the dimensions of the containing div, the div will remain fixed in size and any overflow will cause the scrollbars to appear.
Remove any fixed width from the div itself and apply margins to the div and append to the datagrid via CSS instead.
This should allow the datagrid to always be contained within a div with the same amount of spaces, no matter what size the datagrid is.