Click here to Skip to main content
15,896,201 members

Page grid view not displaying data correctly after 2-3 times

29GJ asked:

Open original thread
In PagedGridView when I am trying to display the result .It is displaying correctly for 2-3 times , then it show the blank page with single column data and again when I click on it it start showing the data correctly.

What I have tried:

<PagedGridView ID="grdCases" runat="server" DefaultSortExpression="NameLast,NameFirst" onpageindexchanging="grdCases_PageIndexChanging" onsorting="grdCases_Sorting" OnRowDataBound="grdCases_OnRowDataBound" >
                <EmptyDataTemplate>No Cases found</EmptyDataTemplate>
                <Columns>
                    <asp:BoundField HeaderText="Number" DataField="Number" SortExpression="CaseNumber" ItemStyle-Wrap="false" />
                    <asp:BoundField HeaderText="Last" DataField="NameLast" SortExpression="NameLast,NameFirst" />
                    <asp:BoundField HeaderText="First" DataField="NameFirst" SortExpression="NameFirst,NameLast" />
                    <asp:BoundField HeaderText="DOB" DataField="DOB" SortExpression="DOB" DataFormatString="{0:MM/dd/yyyy}" ItemStyle-Width="100px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />

<asp:TemplateField ItemStyle-CssClass="ControlColumn" ItemStyle-Width="60">
                        <ItemTemplate>
                            <asp:HyperLink ID="lnkView" NavigateUrl='<%# String.Format("~/Directory/View.aspx?id={0}", Eval("ID")) %>' ToolTip="View Case" runat="server">
                                <asp:Image ID="imgView" ImageUrl="~/Images/View.png" ToolTip="View Case" AlternateText="View Case" runat="server" />
                                View
                            </asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
</Columns>
            </PagedGridView>


private void BindGridView(bool ResetPageIndex)
        {
            pnlSearchResults.Visible = true;

            EntityList<Test.Directory> results = Test.Directory.FindAll(BuildSearchOptions(), grdtest.SortPageOptions);


            grdtest.DataSource = results;
            grdtest.DataBind();
            if (ResetPageIndex) grdtest.PageIndex = 0;
        }
Tags: C#

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900