Click here to Skip to main content
15,896,278 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
HI to everyone
can anybody guide me that how i can put my grid in scroll bar so that my grid row didnt comes out of page layout thanks in advance

OP's answer moved to here:
my grid has almost 15 coloumn and i am using div but grid is going outside the div.i has set width to 400px but again its not working.i need horizontal scroll bar and paging is already uesd
Posted
Updated 16-May-11 12:45pm
v2

Put your Grid control in Panel control and set the Panel scrollbars property to horizontal.
XML
<asp:Panel ID="Panel1" runat="server" ScrollBars="Horizontal">
    </asp:Panel>


I hope this will help you well.
 
Share this answer
 
Comments
waqasahmed786 17-May-11 14:15pm    
thanks its also working
Wonde Tadesse 21-May-11 22:58pm    
You're most welcome.
Although the tutorial is in VB.NET, the html portion that you could potentially use as a solution should give you at least one idea on how to do this.

Tutorial...

[Edit]
Based on the enhancement to your question, you just need to use the "overflow: auto;" attribute in the div surrounding your grid. This will automatically create horizontal and vertical scrollbars.
[/Edit]
 
Share this answer
 
v2
There are few ways you can try.

1) Use paging instead of scrolling. Gridview has a easy paging support.

2) Instead of make the gridview scroll, let the container has the scroll. Wrap the gridview in a DIV section. Set the width and height of the DIV. Use the CSS property overflow to scroll.

Good luck
 
Share this answer
 
the optimum solution is just put this code around div of grid
" style="overflow-x:auto;width:800px"
 
Share this answer
 
v3

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