Scrollable Grid

T

tshad

I was just looking at a site that had scrollable grids and was wondering how
that is done?

It was an aspx page, but I have only seen Datagrids that were
non-scrollable. You can page a grid but I have never seen an option to make
a grid scrollable.

Does anyone know how that is done?

Thanks,

Tom
 
J

John Mott

The primary trick is to put the gridview inside a DIV tag that has a height
and an overflow-y:scroll so that it creates a scroll bar, so the gridview
itself doens't do the scrolling. If you want to have the headers in a fixed
position above the scrolling gridview you copy the header row with
javascript. There is a good example here, i've done it before based on this
logic.

http://www.codeproject.com/useritems/ScrollingGridView.asp

john
 
T

tshad

John Mott said:
The primary trick is to put the gridview inside a DIV tag that has a
height and an overflow-y:scroll so that it creates a scroll bar, so the
gridview itself doens't do the scrolling. If you want to have the headers
in a fixed position above the scrolling gridview you copy the header row
with javascript. There is a good example here, i've done it before based
on this logic.

http://www.codeproject.com/useritems/ScrollingGridView.asp

Div was the way to do it. I didn't realize it had an overflow attribute.
I also create a table with just one row to handle the header.

Here is the way I did it:

<table border=1 cellspacing="0" cellpadding="0" width="475px">
<tr class=jay style="background-color:#3ba4bd; color:FFFFFF;">
<td width="82px">Date Posted</td>
<td width="101px">Posted By</td>
<td width="234px">Note</td>
</tr>
</table>
<div style="height:100px; border-bottom:1px solid
#000000;width:475px;overflow: auto;">
<asp:DataGrid
Visible=true
....

This works really well.

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top