Click here to Skip to main content
15,900,378 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
can any body let me know
How to fix or set the gridview width.
When the data is populated,columns get stretched, and over all
width of grid get increased.

After setting the width of grid, it should have Scrolbar.
and size must not get increased
How to do this.

Thanks
Shanawaz
Posted

Put the gridview in a container like div or panel and set width for panel.If you want to fix the gridview width set width for gridview also.If you give more width to gridview than panel then it'll show scrollbar.
 
Share this answer
 
you can set the cssclass in gridview's itemstyle after you wrote the css code that you need
 
Share this answer
 
Hello,

You can do like this

<div style="height: 260px; width: 470px; overflow: auto; vertical-align: top;">
<asp:DataGrid ID="dgAPVender" AccessKey="G" runat="server" CssClass="clsGrid" BorderColor="Desktop" CellPadding="3" AutoGenerateColumns="False" Width="450px">
//Gridview content here
</asp:DataGrid>				
</div>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900