Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GridView does not show all the rows

I have a GridView on my form. I've set its DataSource to a DataTable. I retrieve DataTable like this:

SELECT AMOUNT, ISSUEDATE,REASON FROM PAYMENTS WHERE 
PENSIONERID=113 ORDER BY ISSUEDATE DESC

When I run this query on the server side I get three records. But on my web page the gridview shows only two of them. There's no condition set on the code behind that would cause the gridview to not show any kind of record. After some time when I restart the server I can see the third row in the gridview. Is this a problem related to my IIS? What could be the reason in any case? Thank you.

Here's the GridView and datat loading code:

<asp:GridView ID="gvOdanBirm" runat="server" AllowPaging="True" 
    AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
    GridLines="None" OnPageIndexChanging="gvPayments_PageIndexChanging" 
    PageSize="3">
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <Columns>
        <asp:BoundField DataField="ISSUEDATE" HeaderText="Issue date">
            <ItemStyle BorderColor="#01055E" BorderStyle="Solid" BorderWidth="1px" 
                HorizontalAlign="Right" Width="70px" />
            <HeaderStyle BorderColor="#01055E" BorderStyle="Solid" BorderWidth="1px" />
        </asp:BoundField>
        <asp:BoundField DataField="AMOUNT" HeaderText="Amount">
            <ItemStyle BorderColor="#01055E" BorderStyle="Solid" BorderWidth="1px" 
                HorizontalAlign="Right" Width="30px" />
            <HeaderStyle BorderColor="#01055E" BorderStyle="Solid" BorderWidth="1px" />
        </asp:BoundField>
        <asp:BoundField DataField="REASON" HeaderText="REASON" 
            >
            <ItemStyle BorderColor="#01055E" BorderStyle="Solid" BorderWidth="1px" 
                HorizontalAlign="Left" Width="50px" />
            <HeaderStyle BorderColor="#01055E" BorderStyle="Solid" BorderWidth="1px" />
        </asp:BoundField>
    </Columns>
    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    <EditRowStyle BackColor="#999999" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>

Code-behind:

 gvPayments.DataSource=  GetPayments(pensionerID);
 gvPayments.DataBind();    
like image 656
Mikayil Abdullayev Avatar asked Jul 02 '26 07:07

Mikayil Abdullayev


1 Answers

Can you try the following?

  1. Look at the source code of the page generated when the row does not appear... is the row not making it into the page at all? Or is it just not displaying for some reason?

  2. Can you get the third row when it isn't appearing by moving to the next page? Temporarily take out the paging commands from the aspx code to see if that resolves it.

  3. Check that the server is up to date with all service packs, etc. for the database, OS, and IIS.

  4. What version of IIS are you running? What server OS?

  5. Can you post the code behind gvPayments_PageIndexChanging, and any code you have behind building the gridview?

  6. What browser are you using to view the results? When you get the error, can you try another browser or another machine? And do you get the same result?

  7. Forgot a biggie... Can you break after gvPayments.DataSource= GetPayments(pensionerID);? Are you getting all three rows retrieved from the database? Maybe your problem isn't in the aspx code, but in the data you're getting back to bind to.

Will think more while you post those.

like image 134
James King Avatar answered Jul 03 '26 22:07

James King



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!