probug
probug

Reputation: 1

How to enable scrolling and disable paging in a dynamic gridview

I have a dynamic gridview, want vertical scrolling functionality and disable paging altogether

Upvotes: 0

Views: 1171

Answers (2)

Vani
Vani

Reputation: 1353

You can wrap the gridview inside a div and set the height of the div. Like

  <div style="overflow: auto; width: 100%;height:200px">
   --your Gridview
  </div>

It worked for me ,where the paging is off for the Gridview.

Upvotes: 1

Aladein
Aladein

Reputation: 312

in gridview PageIndexChanging you must change PageSize to big number size

gridview.PageSize = 100 

or more than 100

for vertical scrolling use java

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="up" runat="server">
    <ContentTemplate>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
            <Columns>
                <asp:BoundField DataField="ContactName" HeaderText="Contact Name" />
                <asp:BoundField DataField="City" HeaderText="City" />
                <asp:BoundField DataField="Country" HeaderText="Country" />
                </Columns>
            </asp:GridView>
                <asp:Button ID="Button1" runat="server" Text="Refresh" />
    </ContentTemplate>
</asp:UpdatePanel>

<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/ScrollableGridViewPlugin_ASP.NetAJAXmin.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#<%=GridView1.ClientID %>').Scrollable({
            ScrollHeight: 300,
            IsInUpdatePanel: true
        });
    });
</script>

Upvotes: 0

Related Questions