Click here to Skip to main content
16,004,647 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am doing a project using asp.net with Gridview ,i am using Panel Control for this task but panel appering on my web page while iam not using gridview
i want it apper only when gridview will call
please suggest me some other tool for scrolling my gridview.

My Code for Panel

XML
<asp:Panel ID="scrollableGridArea" runat="server"
      style="overflow:scroll; height: 300px; width: 1000px; z-index: 105; left: 10px; position: absolute; top: 120px;"
      CssClass="GridviewScrollPager" >
   <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC"
              BorderStyle="None" BorderWidth="1px" CellPadding="3"
              style="z-index: 100; left: 0px; position: absolute; top: 0px"
              CssClass= "GridviewScrollHeader"   >
       <FooterStyle BackColor="White" ForeColor="#000066" />
       <RowStyle ForeColor="#000066" HorizontalAlign="Center" />
       <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
       <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
       <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
   </asp:GridView>
       </asp:Panel>
Posted
Updated 6-Sep-13 23:02pm
v3

I believe you want the entire panel to be hidden when the data is empty. For this, set the
C#
if (data.Rows.Count == 0)  scrollableGridArea.Visible = false;

As for scrolling, if you want to keep the headers locked and data getting scrolled, you can place headers in separate table above the grid and have the grid's own ShowHeader=false. Then wrap the grid in a
ASP.NET
<div style="height:200px; overflow: scroll">
<asp:gridview ...="" xmlns:asp="#unknown">grid properties 
</asp:gridview></div>
 
Share this answer
 
XML
first set panel invisible




<asp:Panel ID="scrollableGridArea" runat="server" visible="false" >
<div style="height:150px; width:300px; overflow:auto">
   <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC"
              BorderStyle="None" BorderWidth="1px" CellPadding="3"
              style="z-index: 100; left: 0px; position: absolute; top: 0px"
              CssClass= "GridviewScrollHeader"   >
       <FooterStyle BackColor="White" ForeColor="#000066" />
       <RowStyle ForeColor="#000066" HorizontalAlign="Center" />
       <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
       <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
       <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
   </asp:GridView>
</div>
       </asp:Panel>
it will add auto scroll to grid when gridview size increase


hope this will help u
 
Share this answer
 
Hi...
See this one,may its helpful to u.
XML
<asp:Panel ID="scrollableGridArea" runat="server" ScrollBars="Vertical"
      style="overflow:scroll; height: 300px; width: 1000px; z-index: 105; left: 10px; position: absolute; top: 120px;"
      CssClass="GridviewScrollPager" >
   <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC"
              BorderStyle="None" BorderWidth="1px" CellPadding="3"
              style="z-index: 100; left: 0px; position: absolute; top: 0px"
              CssClass= "GridviewScrollHeader"   >
       <FooterStyle BackColor="White" ForeColor="#000066" />
       <RowStyle ForeColor="#000066" HorizontalAlign="Center" />
       <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
       <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
       <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
   </asp:GridView>
       </asp:Panel>.

Thank u.
 
Share this answer
 

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