Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GridView in scrollable window

Status
Not open for further replies.

rdgerken

Technical User
Jul 8, 2002
108
Can anyone explain how I could put a gridview inside of a scrollable window? Basically, I'd like the header, footer, and navigation bar to be statically displayed in the browser window at all times, and then the gridview would have scrollbars to pan around in it (if it was too large to show). I thought this would be pretty easy, but I haven't been able to figure it out yet.

Thanks!
 
Put the grid inside of a DIV tag. Set Scroll=AUTO on the DIV. Once the grid expands beyond the dimentions of the DIV, you will see scoll bars.
Jim
 
When you say "gridView," do you mean a Web Form Control Datagrid? If so, it's should be pretty straight forward:

1. Make a blank table
2. Drag and drop a Datagrid control in it
3. Set the following properties on the control:
-AllowPaging = False
-ShowFooter = True
-ShowHeader = True


You can also go into the columns builder (accessible through the grid's properties) and set all these props through there. If the default scrollbars on the whole page aren't what you are looking for then I suggest taking a look at this link. Hope this helps.

-Kevin
 
Thanks for the help guys. I'm almost there. It works, but for some reason, I get a big gap between the gridview (which is now scrollable) and the next items below it on the page. I have tried all kinds of things, but was hoping that you'd be able to help me bring this to completion. The code I have that defines the div is here


Code:
    <div style="position:static; vertical-align:top; height:500px; overflow:auto">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EntityID" EmptyDataText="There are no data records to display."
            DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal" Width="98%" HorizontalAlign="Center" AllowPaging="False" PageSize="12" ShowFooter="True" AllowSorting="True">
            <Columns>
                <asp:CommandField Bu...

Basically, I have a gridview and then directly below it a detailsview. I'd like the page to always be showing the header, footer, navigation bar, and detailsview, and then fill the rest of the page with the scrollable gridview. Is there a way to dynamically assign the height property of the DIV tag so that this is accomplished. I'm really new to HTML, so I'm sorry for my ignorance. Using the DIV tag is definitely getting me on the right track, but I can't figure out how to accomplish what I'm after.

Thanks again for all the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top