Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
using Gridviewscroll demo. I want to create a scroll above the grid also.

If anyone have idea please share .

Thanks.
Posted
Updated 27-Jan-17 22:07pm
v3
Comments
Krunal Rohit 29-Oct-15 0:40am    
Just curious, what's wrong if it is in the bottom ?

-KR
Manoj Sawant 9-Nov-15 2:17am    
Hi Kunal,
i want it above the grid coz my Grid pagesize is 15 and i have 20 columns in the grid, if i had to scroll the grid to extreme right i have to scroll down then scroll right.
Instead if it will be above the grid i need not scroll down but directly scroll right.
adriancs 18-Mar-16 8:08am    
Javascript can do that
Er. Puneet Goel 22-Nov-16 3:26am    
are you still looking for help ?

HI, there is no direct property or method to do so but you can try to customise like in below links which have some examples ,hope these will be helpful..

http://forums.asp.net/t/1851667.aspx?Horizontal+scroll+on+top+as+well+as+bottom[^]

http://stackoverflow.com/questions/3934271/horizontal-scrollbar-on-top-and-bottom-of-table[^]
 
Share this answer
 
Comments
itsathere 8-Sep-15 10:02am    
above solution does not match requirement.I want to implement that in "Gridviewscroll demo".
btw thanks for comment.
HTML Page

<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>



Add Jquery Plugin For Scrolling On Gridview
Java
<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>
 
Share this answer
 
v2
Hi,

This is already solved in other posts.

Find the live example below.

http://jsfiddle.net/TBnqw/1/[^]

-V
 
Share this answer
 
Did you consider using CSS to do this?
There is a good example of this in this post.
 
Share this answer
 
CSS and scripting will help you to move your scrollbar above gridview
see below snippet
HTML code is as follows
HTML
<div class="wrapper1">
  <div class="div1"></div>
</div>
<div class="wrapper2">
  <div class="div2">
    <!-- Content Here -->
  </div>
</div>

//css code is as below
CSS
.wrapper1, .wrapper2 {
  width: 300px;
  overflow-x: scroll;
  overflow-y:hidden;
}

.wrapper1 {height: 20px; }
.wrapper2 {height: 200px; }

.div1 {
  width:1000px;
  height: 20px;
}

.div2 {
  width:1000px;
  height: 200px;
  background-color: #88FF88;
  overflow: auto;
}

JS as below
JavaScript
$(function(){
  $(".wrapper1").scroll(function(){
    $(".wrapper2").scrollLeft($(".wrapper1").scrollLeft());
  });
  $(".wrapper2").scroll(function(){
    $(".wrapper1").scrollLeft($(".wrapper2").scrollLeft());
  });
});

hope it helps
 
Share this answer
 
try This ......................

<div  style="overflow:scroll">
<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>
</div>
 
Share this answer
 
Comments
CHill60 28-Jan-17 9:37am    
That puts a scrollbar at the bottom of the control

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900