More Group Sites
Education Books
School Rankings
Jobless Net
Better Home
Enviro++
更好教育论坛


Help | Subscribe/Unsubscribe | Rules | Other Group Sites: Better Education | Better Education Forum
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post Go to first unread
hong  
#1 Posted : Sunday, 30 August 2015 12:31:44 PM(UTC)
hong

Rank: Administration

Reputation:

Groups: AcademicCoachingSchool, admin, Administration, BookSeller, CatholicSchool, CoachingAdult, CoachingProfessional, CoachingSports, ExtraCurriculumCoaching, IndependentSchool, Moderator, MusicTeacher, PrivateSchool, PublicSchool, SelectiveSchool, tutor
Joined: 23/11/2008(UTC)
Posts: 519

ASP.NET GridView horizontal and/or vertical scrollbars

Just wrap the GridView with a div having overflow style defined, i.e. use div to have scrollbars inside the GridView.
Code:
<div style="overflow:auto">
   GridView here
</div>


You can change overflow:auto to overflow:scroll but that will always show both scrollbars.
Code:
<div style="width:600px; height:400px; overflow:scroll">
   GridView here
</div>


Vertical scrollbar only
1.
Code:
<div style="overflow-y:auto">
   GridView here
</div>


2.
Code:
<div style="height:400px; overflow:auto">
   GridView here
</div>

when the height of GridView exceeds the assigned height.

Horizontal scrollbar only
1.
Code:
<div style="overflow-x:auto">
   GridView here
</div>


2.
Code:
<div style="width:600px; overflow:auto">
   GridView here
</div>

when the width of GridView exceeds the assigned width.

You can also use this approach if you find ASP.NET GridView cannot be horizontally scrolled on a mobile phone portrait. Of course, other than this, you can use other methods to make the GridView truly responsive.

Use ASP.NET Panel instead of Div

See the server side ASP.NET Panel alternative below. Like Div, ScrollBars attribute can be "Auto", "Both", "Vertical", "Horizontal" or "None".
1.
Code:
<asp:Panel ID="Panel1" runat="server" ScrollBars="Vertical" Height="400px">

2.
Code:
<asp:Panel ID="Panel1" runat="server" ScrollBars="Horizontal" Width="600px">

Edited by user Sunday, 30 August 2015 12:59:39 PM(UTC)  | Reason: Not specified

Sponsor
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.