paging in gridview?
-
hi, In my project using gridview and handling paging. paging is not working for me. there is not error raised in pageindexchanging. following is my gridview. whats the thing need to write in grdcountry_pageindexchanging. Any sample code please. vert urgent please <asp:GridView ID="grdCountry" runat="server" AutoGenerateColumns="False" BorderWidth="1px" CellPadding="5" CssClass="Grid" DataKeyNames="pk_country_id" ForeColor="#284E98" GridLines="Vertical" Width="50%" PageSize="25" AllowPaging="True" AllowSorting="True" onpageindexchanging="grdCountry_PageIndexChanging" EnableSortingAndPagingCallbacks="True"> <PagerSettings Mode="NextPreviousFirstLast" position="Bottom" pagebuttoncount="10"/> <pagerstyle backcolor="LightBlue"/> <RowStyle BackColor="#EFF3FB" /> <Columns> <asp:BoundField DataField="country_name" HeaderText="Country Name"> <ItemStyle HorizontalAlign="Left" /> </asp:BoundField> <asp:CommandField ButtonType="Button" ShowCancelButton="False" ShowSelectButton="True" /> </Columns> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#2461BF" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView>
Have A Nice Day! Murali.M Blog
-
hi, In my project using gridview and handling paging. paging is not working for me. there is not error raised in pageindexchanging. following is my gridview. whats the thing need to write in grdcountry_pageindexchanging. Any sample code please. vert urgent please <asp:GridView ID="grdCountry" runat="server" AutoGenerateColumns="False" BorderWidth="1px" CellPadding="5" CssClass="Grid" DataKeyNames="pk_country_id" ForeColor="#284E98" GridLines="Vertical" Width="50%" PageSize="25" AllowPaging="True" AllowSorting="True" onpageindexchanging="grdCountry_PageIndexChanging" EnableSortingAndPagingCallbacks="True"> <PagerSettings Mode="NextPreviousFirstLast" position="Bottom" pagebuttoncount="10"/> <pagerstyle backcolor="LightBlue"/> <RowStyle BackColor="#EFF3FB" /> <Columns> <asp:BoundField DataField="country_name" HeaderText="Country Name"> <ItemStyle HorizontalAlign="Left" /> </asp:BoundField> <asp:CommandField ButtonType="Button" ShowCancelButton="False" ShowSelectButton="True" /> </Columns> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#2461BF" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView>
Have A Nice Day! Murali.M Blog
thanks to all. i got the solution for this problem.
protected void grdCountry_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
try
{
grdCountry.PageIndex = e.NewPageIndex;
LoadCountryGrid();
}
catch (Exception ex)
{
ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "HOSPMS", "alert('" + ex.Message + "!')", true);
}
}Have A Nice Day! Murali.M Blog