473,549 Members | 2,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

add scrollbar in gridview

97 New Member
Hi all,

Does anyone know how we can add a ScrollBars into a GridView when it has a lot of columns to display?


Thanks and Regards...
Sand.
Dec 18 '06 #1
12 68627
vinaykeshav
25 New Member
Drop a DataGrid Web control onto the page and resize it to the size you would like.

Then drop an HTML Label Control onto the page. This is the same as a <div>. I am using the html version, since I do not need any of the extra features (or overhead) associated with a Web control. I would recommend giving this control an id, so that it is easier to find when making further changes.

Next, I can drag the datagrid inside of the label. You know you've got it in the right spot to drop when the label suddenly gains focus. When you drop the grid, the label will automatically resize itself to the size of the grid.

Additionally, you will notice that there is an anchor in the upper left corner of the label which will allow you to drag the combined controls. It is possible to select the individual controls as well in the design screen so that you can affect either of them as needed.

The next key step is to enable the scroll bar. You do this by going into the STYLE properties of the label. Rather than manually editing them, open up the style builder for the control. This can be done by right clicking on the label and choosing "Build Style" or clicking on the ellipsis on the style parameter in the properties window.

On the layout page of the style builder, there is an option for Overflow. Overflow has five settings. One of these is blank, two are for scrolling and two are for clipping. I use the "Use Scrollbars if Needed" selection.


hi all...
does anyone know how we can add a scrollbar into a gridview when it's having a lot of columns to display???
please help...
thanks and regards...
sand...
Dec 18 '06 #2
sandeepk84
97 New Member
Drop a DataGrid Web control onto the page and resize it to the size you would like.

Then drop an HTML Label Control onto the page. This is the same as a <div>. I am using the html version, since I do not need any of the extra features (or overhead) associated with a Web control. I would recommend giving this control an id, so that it is easier to find when making further changes.

Next, I can drag the datagrid inside of the label. You know you've got it in the right spot to drop when the label suddenly gains focus. When you drop the grid, the label will automatically resize itself to the size of the grid.

Additionally, you will notice that there is an anchor in the upper left corner of the label which will allow you to drag the combined controls. It is possible to select the individual controls as well in the design screen so that you can affect either of them as needed.

The next key step is to enable the scroll bar. You do this by going into the STYLE properties of the label. Rather than manually editing them, open up the style builder for the control. This can be done by right clicking on the label and choosing "Build Style" or clicking on the ellipsis on the style parameter in the properties window.

On the layout page of the style builder, there is an option for Overflow. Overflow has five settings. One of these is blank, two are for scrolling and two are for clipping. I use the "Use Scrollbars if Needed" selection.

Thanks a lot Vinay....
Earlier i had tried using div...then i was not able to get it...
but now i got it...
thanks,
sand...
Dec 18 '06 #3
Nir
3 New Member
thanks alot vinaykeshav
you are the best...
really it"s the best answer!
good for you man..
Nir
May 21 '07 #4
satane
4 New Member
HI Vinay,

i did the whole process.But i am not getting scoll bar to lable also.can u please currct my code.in which case i did worng.i am sending my code here

Expand|Select|Wrap|Line Numbers
  1. <label id=lab runat="server" style="overflow: auto">h<asp:GridView
  2.                    AllowSorting=True   
  3.                    ID="grdView" 
  4.                    runat="server"
  5.                    Width="47%" 
  6.                    GridLines="Horizontal" 
  7.                    PageSize =18
  8.                    OnPageIndexChanging="grdView_PageIndexChanging"
  9.                    OnSorting ="grdView_OnSorting"
  10.                    DataKeyNames="Boss" Height="1px"  AutoGenerateColumns=true Enabled=true
  11.  
  12.                    >
  13.  
  14.                <RowStyle Backcolor="#E1E1FF" />
  15.         <HeaderStyle BackColor="RosyBrown" ForeColor="Green" />
  16.                               </asp:GridView>
  17.             i&nbsp;</label>
Aug 17 '07 #5
ayhtut
1 New Member
Hi, use <asp:Label> , not <label>... but I can't get it in firefox.. but for IE , it's ok :) ...

HI Vinay,

i did the whole process.But i am not getting scoll bar to lable also.can u please currct my code.in which case i did worng.i am sending my code here


<label id=lab runat="server" style="overflow : auto">h<asp:Gri dView
AllowSorting=Tr ue
ID="grdView"
runat="server"
Width="47%"
GridLines="Hori zontal"
PageSize =18
OnPageIndexChan ging="grdView_P ageIndexChangin g"
OnSorting ="grdView_OnSor ting"
DataKeyNames="B oss" Height="1px" AutoGenerateCol umns=true Enabled=true

>

<RowStyle Backcolor="#E1E 1FF" />
<HeaderStyle BackColor="Rosy Brown" ForeColor="Gree n" />
</asp:GridView>
i&nbsp;</label>
Sep 8 '07 #6
shalu2singh
1 New Member
how to fetch data in dropdownlist within gridview?
what is datasource ID in dropdownlist?
Oct 25 '07 #7
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
how to fetch data in dropdownlist within gridview?
what is datasource ID in dropdownlist?
A datasource in a dropdownlist is the source from where it populates its list.
To find the data selected in this dropdownlist, you will have to use the findcontrol method for that row in the datagrid.

I havent really coded this myself(just been helping and watching this code) , but this is how it was done in my project
Oct 25 '07 #8
kunal pawar
297 Contributor
hi all...
does anyone know how we can add a scrollbar into a gridview when it's having a lot of columns to display???
please help...
thanks and regards...
sand...
You can used:
Expand|Select|Wrap|Line Numbers
  1. <div id='div1' style="width:'100%'; height:'50%'; overflow:scroll;">
  2. <datagrid>
  3. </datagrid>
  4. </div>
Oct 25 '07 #9
Deepti05
2 New Member
You can used
Expand|Select|Wrap|Line Numbers
  1. <div id='div1' style="width:'100%'; height:'50%'; overflow:scroll;">
  2. <datagrid>
  3. </datagrid>
  4. </div>
But if no row is there then empty space will be there how to remove that space when there is no row in grid
Jan 16 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5935
by: Javier Martinez | last post by:
Hi Is there any way to set a horizontal scrollbar in a gridview? Thanks in advance Javier
4
8609
by: Gunawan | last post by:
Hi, I have a gridview inside a table <table>...</table> I have define explicitly wide of the table, for example 800px. If we need gridview which is inside 800px table wider than table wide, how can I show horizontal scroll bar on it? I do not want to change the wide of main table. Thank you. TIA & Regards, Gun
1
3947
by: madhurisajja | last post by:
Hi All, I have a Gridview inside a Panel and i have set overflow to auto for the scroll bars to appear. I have a server side code that handles the up and down key arrows. The problem i have is when i select rows in gridview with arrow keys my scroll bar will scroll faster then my arrow keys. I want the scroll bar to scroll with arrow keys. ...
3
24816
by: Jimmy B | last post by:
Hello folks, Does anyone of you know any Open Source GridView Extension that has vertical Scrollbar and fixed Header? Tried to Google but didn't find any proper (because of Css). It should work in IE, Firefox and Opera. Cheers!
1
3322
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a problem whereby I have a gridview bound to a dataset with a large number of items, However when I select an item near the bottom by using the scrollbar, when the gridview gets rebound, the selected field goes off the screen and is not visible and the user has to use the scrollbar to see it. How do I set the toprow of the visible...
5
4229
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I am using <asp:Gridview> to display my data. I am adding columns and rows dynamically. I am facing following issues: 1. I want scrollbars around the gridview and for this purpose i used <div style="overflow:auto"> and its working fine. But issue is that the header row also scroll down with scrollbar and i want to fix header row ....
18
24775
by: btreddy | last post by:
Hii all, In one my child page i've an updatepanel which contains a gridview .The gridview displays huge amt of data (~3 pages of data) and the updatepanel refreshes for every 1 sec,for tht i've used timer control, to get the updated data from the server.for that i've used one timer. The problem is ,the webpages scroll bar(both horizontal...
0
2348
by: NareshN | last post by:
Hi All, I am trying freez first column of each row in gridview using Css but it is not working. <link href="Includes/Styles1.css" rel="stylesheet" type="text/css" /> <title>Untitled Page</title> <style type="text/css">
3
7846
by: NareshN | last post by:
Hi All, Can u tell me how to freeze gridview header and first column of each row in IE 8. I am below code but it is not working for me.The same code is working fine in Sample which i am running in Same browser IE8. <style type="text/css"> /* Div container to wrap the datagrid */div#div-datagrid { ...
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6041
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.