Solved

Gridview scroll bar

Posted on 2012-04-09
2
472 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

726 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