0

I am embedding a gridview inside of a panel like this, which works as it should, but I sometimes return a great deal of information and would like to be able to add a horizontal scroll bar to the top as well, can someone assist??

<asp:Panel ID="panel1" runat="server" ScrollBars="Both" style="overflow:scroll">
<asp:GridView ID="grid1" runat="server" Visible="True" AutoGenerateColumns="false" 
        ShowFooter="true" Width="16px" Height="120px" >/>
        <columns>

        </columns>
    </asp:GridView>
</asp:Panel>

EDIT

I am trying to use the option from the link you provided below, but my grid width is way to small. I think I have it set properly in the syntax tho?

<div class="wrapper1">
    <div class="wrapper2">
        <asp:GridView ID="grid1" runat="server" Visible="True" AutoGenerateColumns="false" 
            ShowFooter="true" Width="10000pxpx" Height="3000px" >/>
            <columns>

            </columns>
        </asp:GridView>
    </div>
</div>

<style type="text/css">
    .wrapper1, .wrapper2{width: 300px; border: none 0px RED; overflow-x: scroll; overflow-y:hidden;}
    .wrapper1{height: 200px; }
    .wrapper2{height: 200px; }
    .div1 {width:10000px; height: 200px; }
    .div2 {width:10000px; height: 200px; background-color: #88FF88; overflow: auto;}
</style>

Also, adding in the extra <div> tag throws the grid further down on the page than what I need it to be.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
RedLight GreenLight
  • 173
  • 1
  • 5
  • 16

1 Answers1

0

You can try removing your panel and go with a div instead.

<div style="overflow-x:auto;width:800px">
   GridView here
</div>

overflow-x:auto will produce a horizontal scrollbar only if the GridView's width is greater than 800px.

Scotty
  • 1,127
  • 1
  • 7
  • 17