Solved

Gridview scroll bar

Posted on 2012-04-09
2
457 Views
Last Modified: 2012-04-10
Hello, I have a gridview that has a scroll. When the table has a lot of records. It helps me.
However sometimes the gridview is empty. It also display the scroll. It is ugly.
How to remove it?
I mean dynamically control the scroll.
#gridview
{
    float: right;
    overflow: scroll;
    width: 675px;
}

Open in new window

<div id="gridview">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" BorderColor="YellowGreen"
                    DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="ProbId"
                    PageSize="30" AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" Visible="true">

Open in new window

0
Comment
Question by:zhshqzyc
2 Comments
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37825270
here is a simple suggestion, put your gridview in asp:panel control and display scrollbars.
At the time of Datbinding see if your datasource has data then add scrolling to panel otherwise remove the scroll.
pnlTest.ScrollBars = ScrollBars.Vertical;
pnlTest.ScrollBars = ScrollBars.None;

Open in new window

0
 
LVL 5

Expert Comment

by:Vishal Kedar
ID: 37826425
try below code

#gridview
{
    float: right;
    overflow: scroll;
    width: 675px;
    height:400px      //whatever height you want.
}

it may helps.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
listing all functions in JavaScript 19 105
using web browser with BING 40 86
JavaScript Scope issue 4 20
Adjust the position 3 12
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article discusses how to create an extensible mechanism for linked drop downs.
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now