Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello dear friends and sir,

how to scroll data of gridview in asp.net with c# language.

i want to use gridview and all table data using scrolling show in the page.

thanks
Posted

keep your grid view inside panel.
 
Share this answer
 
XML
Hi...
using panel in gridview like this.its may useful to u.

<pre lang="c#"><asp:Panel ID="panel1" runat="server" Height="161px" Width="519px" ScrollBars="Horizontal">
                <asp:GridView ID="GridView1" runat="server" HeaderStyle-BackColor="Lavender" BorderColor="Red"  HeaderStyle-ForeColor="IndianRed"
                    AlternatingRowStyle-BackColor="DarkSeaGreen"
                    SelectedRowStyle-ForeColor="Blue" Height="37px" Width="768px"
                    AutoGenerateColumns="False">
                    <AlternatingRowStyle BackColor="LightGoldenrodYellow" />
                    <Columns>
                        <asp:BoundField DataField="CML_Number" HeaderText="CML_Number" />
                        <asp:BoundField DataField="Product_Name" HeaderText="Product_Name" />
                     </Columns>
                    &lt;HeaderStyle ForeColor="CornflowerBlue" />
                    &lt;SelectedRowStyle ForeColor="Blue" />
                </asp:GridView></asp:Panel> </pre>

thank u.
 
Share this answer
 
Comments
Rajasri Kannan 28-Sep-15 16:59pm    
Using Panel Control resolved the issue.

Thank You!!
use this style with your div in which you have grid view

style="width: 100%; height: 70%; overflow: auto"


or use panel and set its property Scroll to horizontal or vertical which u want
 
Share this answer
 
v3
 
Share this answer
 
C#
 <div style="width: 100%; height: 70%; overflow: auto">
 <asp:gridview id="gvEmpLoginReport" runat="server"> 
 </asp:gridview>
</div>/pre>


Here is the example how you can give scroll bar to your gridView
use css 'overflow' property.
you can give it auto, scroll base on your choice...

Hope this work for you..
 
Share this answer
 
v2
Comments
santsho kumar 20-Jun-13 3:33am    
thank you sir reply to my questions and your solutin is good but not scroll automatic.
salah9 20-Jun-13 3:37am    
i believe, if the data in gridview is more than the page height, than automatically scroll bar appears...

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