Solved

Gridview scroll bar

Posted on 2012-04-09
2
460 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

929 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

11 Experts available now in Live!

Get 1:1 Help Now