0

I have a gridview on a asp web page and the formatting works fine except when I add AllowPaging or if I set the location of the gridview. Here is the gridview code that I am using.

<asp:GridView 
ID="gridview01" 
runat="server" 
SkinId="Professional" 
AllowPaging="true"
CellPadding="4" 
EnableModelValidation="True" 
ForeColor="#333333" 
GridLines="None" 
Height="179px" 
Width="496px" 
style="margin-right: 0px"> 
    <AlternatingRowStyle BackColor="White" />
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>

The top portion is just laid out like that so that I could read it easier. The gridview is populated when a button is pressed. There is code behind the button that calls the query based on the input of two drop down lists.

Amirhossein Mehrvarzi
  • 18,024
  • 7
  • 45
  • 70
Tim Vavra
  • 537
  • 1
  • 19
  • 35

1 Answers1

0

Use THis Code at BackEnd For Paging in Grid or ListView

protected void Grid_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{

   GridDataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);

    BindGridView();

}
Abhishek Patel
  • 4,280
  • 1
  • 24
  • 38