Jaya Prakash

Jaya Prakash

  • 548
  • 2.3k
  • 63.3k

Unable to get Paging in gridview

Dec 18 2023 5:27 AM

 

<div style="overflow:auto hidden; width:100%;" class="col-sm-12">
          <asp:GridView ID="CreditcardPaymentview" class="table table-bordered table-hover dataTable"  HeaderStyle-BackColor="#334d88" runat="server" 
               AllowPaging="false" 
              AutoGenerateColumns="False"
               EmptyDataText="No Records Found" ShowFooter="true" 
            ShowHeaderWhenEmpty="true"
              OnRowDataBound="grdvwTransactions_RowDataBound"
               pagesize="10" CellPadding="3"  >
              
                 <PagerStyle CssClass="paginate_btns" BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />                                                                                        
                 <PagerSettings FirstPageText="Previous" LastPageText="Next" PageButtonCount="5" />                                
                 <FooterStyle BackColor="#006699" ForeColor="white" CssClass="tab1" />
               <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="tab1" /> 
                            <Columns>
                           <asp:BoundField DataField="RowNo" HeaderText="RowNo"/>
                               <asp:TemplateField HeaderText="Action">
                                 <ItemTemplate>
                                      <asp:LinkButton visible="false" runat="server" title="Requery" ID="lnkRefresh" CommandArgument='<%#Bind("RowNo")%>'   class="fa fa-x fa-refresh"  aria-hidden="true" OnClick="lnkRefresh_Click"></asp:LinkButton>                                                 
                                      <asp:LinkButton  visible="false" runat="server" title="Refund" ID="lnkRefund" CommandArgument='<%#Bind("RowNo")%>'   class="fa fa-x fa-rupee"  aria-hidden="true"  OnClick="lnkRefund_Click"></asp:LinkButton>                                                 
          
                                 </ItemTemplate>      
                                </asp:TemplateField>
                                    <%-- <asp:TemplateField HeaderText="Ref ID"  ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                                     <ItemTemplate>
                                     <asp:HyperLink ID="link" runat="server" Text='<%# Eval("TransactionID") %>'>
                                     </asp:HyperLink>
                                     </ItemTemplate>
                                     </asp:TemplateField>--%>

                                <asp:BoundField DataField="RefID" HeaderText="Ref ID"/>
                                <asp:BoundField DataField="AckNo" HeaderText="AckNo"/>
                                <asp:BoundField DataField="UTR" HeaderText="UTR"/>
                                <asp:BoundField  DataField="CreatedDate" HeaderText="Date"/>
                                <asp:BoundField  DataField="ModifiedDate" HeaderText="UpdatedDate"/>
                                <asp:BoundField  DataField="OutletName" HeaderText="Agent"/>
                                <asp:BoundField  DataField="Name" HeaderText="Name"/>
                                <asp:BoundField  DataField="MobileNumber" HeaderText="MobileNumber"/>
                                <asp:BoundField DataField="CreditCardNumber" HeaderText="CreditCardNumber"/>
                                  <asp:BoundField DataField="Amount" HeaderText="Amount" DataFormatString="{0:c}"/>
                                  <asp:BoundField DataField="Network" HeaderText="Network"/>
                                <asp:BoundField DataField="Charges" HeaderText="Charges" DataFormatString="{0:c}"/>
                                <asp:BoundField DataField="ChargesValue" HeaderText="Charges %" ItemStyle-CssClass="hdnboundcolmn" HeaderStyle-CssClass="hdnboundcolmn"/>
                                <asp:BoundField DataField="GST" HeaderText="GST" DataFormatString="{0:c}"/>
                                <asp:TemplateField HeaderText="Status">
                                     <ItemTemplate>
                                          
                                    <span  class='text-bold text-<%# Eval("Status").ToString() == "FAILED" ? "red" :  Eval("Status").ToString() == "PENDING"? "yellow" :Eval("Status").ToString() == "SUCCESS" ? "green": Eval("Status").ToString() == "REFUND" ? "orange":"green" %>' style="font-size: 13px;font-weight:bold;"><%# Eval("Status") %></span>
                                     </ItemTemplate>
                                 </asp:TemplateField>
                               <%-- <asp:BoundField DataField="BankTransactionID" HeaderText="UTR No"/>--%>
                                <asp:BoundField DataField="IPAddress" HeaderText="IPAddress"/>
                                
                                <asp:BoundField DataField="Network" HeaderText="Payment Method"/>
                                <asp:BoundField DataField="APIPartnerName" HeaderText="Product Type"/>
                                <asp:BoundField DataField="Source" HeaderText="Source"/>
                                
                                <asp:BoundField DataField="DeviceID" HeaderText="DeviceID"/>

                                <%--<asp:BoundField DataField="BankName" HeaderText="BankName" Visible="false"/>--%>

                          </Columns>
                          <RowStyle ForeColor="#000066" />
                          <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />                                                       
                      </asp:GridView>
  <%--  <asp:Label ID="lblentries" runat="server" Text="" ForeColor="#000066" ></asp:Label>--%>
        

        </div>
<div style="float:right"><asp:Repeater ID="rptPager" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lnkPage" BackColor="white" BorderStyle="Solid" BorderColor="white" runat="server"  OnClick="Page_Changed" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'  Height="20" Width="20" Font-Size="Medium" ForeColor="#334d88"></asp:LinkButton>
</ItemTemplate>
</asp:Repeater></div>

for the above code im getting gridview paging  like below

but when i use the same code for another webform im not getting gridview paging

and my code is

<div style="overflow:auto hidden; width:100%;" class="col-sm-12">
          <asp:Label ID="lblentries" runat="server" Text="" ForeColor="#000066" style="padding-top:5px;"></asp:Label>
               <asp:GridView  ID="LoginGrdView" runat="server"  HeaderStyle-BackColor="#5d6dc3" class="table table-bordered table-hover dataTable"  AutoGenerateColumns="False" AllowPaging="false" 
                       EmptyDataText="No Records Found" ShowHeaderWhenEmpty="true"
                        OnDataBound="grdForward_DataBound" 
                        ShowFooter="true" PageSize="10"
                        CellPadding="3">
                        <PagerStyle CssClass="gridview" BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />           
                        <FooterStyle BackColor="#006699" ForeColor="white" CssClass="tab1" />
                        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="tab1" />
           <PagerSettings  FirstPageText= "<" LastPageText=">" PageButtonCount="5" />         
                          <Columns>
                             <asp:BoundField DataField="RowNo" HeaderText="RowNo" />
                              <asp:BoundField DataField="CreatedDate" HeaderText="LogIn Date"/>
                              <asp:BoundField  DataField="IPAddress" HeaderText="IP-Address"/>
                              <asp:BoundField  DataField="DeviceID" HeaderText="DeviceID"/>
                              <asp:BoundField DataField="RetailerLatitude" HeaderText="Latitude"/>
                              <asp:BoundField  DataField="RetailerLongitude" HeaderText="Longitude"/>
                                <asp:BoundField DataField="Source" HeaderText="Source" />
                        </Columns>
                        <RowStyle ForeColor="#000066" />
                        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />                                                       
                    </asp:GridView>
        													
            
</div>
<div style="float: right">
      <asp:Repeater ID="rptPager" runat="server">
          <ItemTemplate>
<%--            <asp:LinkButton ID="btnlnk" runat="server" Text='<%# Eval("Text") %>' CommandArgument='<%# Eval("Value") %>' Enabled='<%# Eval("Enabled") %>' OnClick="btnlnk_Click" ></asp:LinkButton>--%>
    <asp:LinkButton ID="lnkPage" BackColor="white" BorderStyle="Solid" BorderColor="white" runat="server"  OnClick="Page_Changed" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'  Height="20" Width="20" Font-Size="Medium" ForeColor="#334d88"></asp:LinkButton>                                         
        </ItemTemplate>
    </asp:Repeater>
</div>

and im getting like this


Answers (6)