This is a migrated thread and some comments may be shown as answers.

sort column then paging ,grid data disappears

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chinna
Top achievements
Rank 1
chinna asked on 01 Apr 2010, 02:43 PM
Hello ,
Recently we come across one issue on the grid, Sorted one column data then clicked on paging  navigated to next page but grid does not show the data. If i remove sorting the grid data is showing. 
our telerik version : 2008.1.515.35 

copied ASPX and codebehind code to replicate issue. 

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml" >

 

<

 

head runat="server">

 

 

<title>Untitled Page</title>

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" AsyncPostBackTimeout="36000">

 

 

</telerik:RadScriptManager>

 

 

<div>

 

 

<telerik:radgrid id="SearchResultsRadGrid" runat="server" allowsorting="True" gridlines="None"

 

 

skin="Office2007" autogeneratecolumns="False" pagerstyle-alwaysvisible="False"

 

 

allowpaging="True" showstatusbar="true"

 

 

AllowFilteringByColumn="true"

 

 

OnNeedDataSource="SearchResultsRadGrid_NeedDataSource"

 

 

OnItemEvent="SearchResultsRadGrid_ItemEvent"

 

 

OnItemDataBound="SearchResultsRadGrid_ItemDataBound"

 

 

>

 

 

<ClientSettings>

 

 

<Resizing

 

 

AllowColumnResize="true"

 

 

AllowRowResize="false"

 

 

ResizeGridOnColumnResize="true"

 

 

ClipCellContentOnResize="false"

 

 

EnableRealTimeResize="true" />

 

 

</ClientSettings>

 

 

<MasterTableView DataKeyNames="FilingID" ShowHeadersWhenNoRecords="True" UseAllDataFields="True">

 

 

<NoRecordsTemplate>No results found</NoRecordsTemplate>

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="DocumentID" HeaderText="Document ID" Display="false" UniqueName="DocumentID" Visible="false" />

 

 

<telerik:GridBoundColumn DataField="DocumentVersion" HeaderText="Document Version" Display="false" UniqueName="DocumentVersion" Visible="false" />

 

 

<telerik:GridTemplateColumn UniqueName="FiledDocument" AllowFiltering="false" HeaderText="Image">

 

 

<ItemTemplate>

 

 

<a id="FiledDocumentHtmlAnchor" runat="server"

 

 

visible="false"

 

 

href="#"

 

 

onclick="ShowFiledDocumentViewer('{0}', '{1}');return false;"

 

 

title="Click to view filed document"><img src="../../Images/FiledDocument.gif" border="0" alt="View Filed Document Image" /></a>

 

 

<a id="BackscanRequestHtmlAnchor" runat="server"

 

 

visible="false"

 

 

href="#"

 

 

onclick="ShowBackScanRequest('{0}');return false;"

 

 

title="Click to generate a Back Scan Request"><img src="../../Images/16x16/scan.gif" border="0" alt="View Filed Document Image" /></a>

 

 

</ItemTemplate>

 

 

<HeaderStyle Width="40px" />

 

 

<ItemStyle HorizontalAlign="Center" />

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn DataField="DocumentPageCount" HeaderText="Pages" UniqueName="DocumentPageCount" allowsorting="false" AllowFiltering="false">

 

 

<HeaderStyle Width="40px" HorizontalAlign="Center" />

 

 

<ItemStyle HorizontalAlign="Center" />

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="InitialFileNumber" HeaderText="Initial File Number" UniqueName="InitialFileNumber" Visible="false" />

 

 

<telerik:GridBoundColumn DataField="FileNumber" HeaderText="File Number" UniqueName="FileNumber" Visible="false" />

 

 

 

<telerik:GridTemplateColumn HeaderText="File Number" DataField="FileNumber" UniqueName="FileNumberLink" SortExpression="FileNumber">

 

 

<ItemTemplate>

 

 

<a id="FileNumberHtmlAnchor" runat="server"

 

 

href="#"

 

 

onclick="ShowFileChainReport('{0}');return false;"

 

 

title="Click to view Filing Chain" />

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridDateTimeColumn

 

 

HeaderText="File Date"

 

 

SortExpression="FileDate"

 

 

DataFormatString="{0:MM/dd/yyyy}"

 

 

UniqueName="FileDate"

 

 

DataField="FileDate"

 

 

ConvertEmptyStringToNull="true">

 

 

</telerik:GridDateTimeColumn>

 

 

<telerik:GridBoundColumn DataField="LapsedDate" HeaderText="Lapsed Date" UniqueName="LapsedDate" Visible="true" />

 

 

<telerik:GridTemplateColumn HeaderText="Party Type" UniqueName="PartyTypeEntity" AllowFiltering="false">

 

 

<ItemTemplate>

 

 

<asp:Label ID="PartyTypeEntityLabel" runat="server" Text="{0} ({1})" />

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn DataField="PartyTypeDebSec" HeaderText="Party Type" UniqueName="PartyType" Visible="false" />

 

 

<telerik:GridBoundColumn DataField="PartyTypeIndOrg" HeaderText="Party Entity" UniqueName="PartyEntity" Visible="false" />

 

 

 

<telerik:GridBoundColumn DataField="FullPartyName" HeaderText="Party Name" UniqueName="FullPartyName" SortExpression="FullPartyName" />

 

 

 

<telerik:GridBoundColumn DataField="Address1" HeaderText="Party Address" UniqueName="Address1" SortExpression="Address1" />

 

 

<telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City" SortExpression="City"/>

 

 

<telerik:GridBoundColumn DataField="State" HeaderText="State" UniqueName="State" SortExpression="State"/>

 

 

<telerik:GridBoundColumn DataField="PostalCode" HeaderText="Postal Code" UniqueName="PostalCode" SortExpression="PostalCode" />

 

 

</Columns>

 

 

</MasterTableView>

 

 

</telerik:radgrid>

 

 

</div>

 

 

</form>

 

</

 

body>

 

</

 

html>

 



CODE BEHIND 

using

 

System;

 

using

 

System.Collections;

 

using

 

System.Configuration;

 

using

 

System.Data;

 

using

 

System.Linq;

 

using

 

System.Web;

 

using

 

System.Web.Security;

 

using

 

System.Web.UI;

 

using

 

System.Web.UI.HtmlControls;

 

using

 

System.Web.UI.WebControls;

 

using

 

System.Web.UI.WebControls.WebParts;

 

using

 

System.Xml.Linq;

 

using

 

Telerik.Web.UI;

 

using

 

System.Collections.Generic;

 

 

 

namespace

 

WebApplication2

 

{

 

public partial class _Default : System.Web.UI.Page

 

{

 

List<UCCSearchResults> searchresults = new List<UCCSearchResults>();

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

}

 

protected void SearchResultsRadGrid_ItemEvent(object sender, GridItemEventArgs e)

 

{

 

GridInitializePagerItem info = e.EventInfo as GridInitializePagerItem;

 

 

if (info != null)

 

{

 

//e.Canceled = true;

 

 

//(e.Item as GridPagerItem).PagerContentCell.Controls.Add(

 

 

// new SWCustomPager(info.PagingManager, e.Item.OwnerTableView));

 

}

 

}

 

 

protected void SearchResultsRadGrid_ItemDataBound(object source, GridItemEventArgs e)

 

{

 

try

 

{

 

if (e.Item is GridDataItem)

 

{

 

UCCSearchResults result = e.Item.DataItem as UCCSearchResults;

 

 

if (result != null)

 

{

 

HtmlAnchor FiledDocumentHtmlAnchor, BackscanRequestHtmlAnchor, FileNumberHtmlAnchor;

 

 

Label PartyTypeEntityLabel;

 

 

// Link to view a document image or request a back scan

 

 

if (((FiledDocumentHtmlAnchor = (HtmlAnchor)e.Item.FindControl("FiledDocumentHtmlAnchor")) != null)

 

&& ((BackscanRequestHtmlAnchor = (

HtmlAnchor)e.Item.FindControl("BackscanRequestHtmlAnchor")) != null))

 

{

 

bool hasDocuments = (result.DocumentPageCount.HasValue && result.DocumentPageCount > 0);

 

 

// If it has documents, then show the Filed Document Viewer icon.

 

 

// Otherwise, show the Request Back Scan icon.

 

 

if (hasDocuments)

 

{

FiledDocumentHtmlAnchor.Attributes[

"onclick"] = string.Format(

 

FiledDocumentHtmlAnchor.Attributes[

"onclick"], result.DocumentID, result.DocumentVersion);

 

}

 

else

 

{

BackscanRequestHtmlAnchor.Attributes[

"onclick"] = string.Format(

 

BackscanRequestHtmlAnchor.Attributes[

"onclick"], result.FilingID);

 

}

FiledDocumentHtmlAnchor.Visible = hasDocuments;

BackscanRequestHtmlAnchor.Visible = !hasDocuments;

}

 

// Link to view a file chain report.

 

 

if ((FileNumberHtmlAnchor = (HtmlAnchor)e.Item.FindControl("FileNumberHtmlAnchor")) != null)

 

{

FileNumberHtmlAnchor.Attributes[

"onclick"] = string.Format(FileNumberHtmlAnchor.Attributes["onclick"], result.FileNumber);

 

FileNumberHtmlAnchor.InnerText = result.FileNumber;

}

 

// Party Type/Entity combination column.

 

 

if ((PartyTypeEntityLabel = (Label)e.Item.FindControl("PartyTypeEntityLabel")) != null)

 

{

PartyTypeEntityLabel.Text =

string.Format(PartyTypeEntityLabel.Text, result.PartyTypeDebSec, result.PartyTypeIndOrg);

 

}

}

}

}

 

catch (System.Exception ex)

 

{

 

// this.ShowException(ex);

 

}

}

 

 

protected void SearchResultsRadGrid_NeedDataSource(object sender, EventArgs e)

 

{

 

 

// this.RadGrid1.MasterTableView.SortExpressions.

 

 

this.SearchResultsRadGrid.DataSource = populateData();

 

}

 

private List<UCCSearchResults> populateData()

 

{

 

//searchresults.Add

 

 

 

for(int i=1 ; i <15;i++)

 

{

 

UCCSearchResults results = new UCCSearchResults();

 

results.FilingID = i;

results.FileNumber =

"090316000018";

 

results.InitialFileNumber =

"090316000018";

 

results.FileDate =

DateTime.Now;

 

results.Address1 =

"test" + i;

 

results.City =

"City" + i;

 

results.Country =

"Country" + i;

 

results.County =

"Wake" + i;

 

results.DocumentID = i;

results.DocumentPageCount = 0;

results.DocumentVersion = 0;

results.FirstName =

"firstname" + i;

 

results.FullPartyName =

"fullpartyname" + i;

 

results.IsIndividual =

true;

 

results.LapsedDate =

DateTime.Now.AddYears(5);

 

results.LastName =

"last" + i;

 

results.LOBTypeID = 0;

results.MiddleName =

"Middle" + i;

 

results.OrganizationName =

string.Empty;

 

results.PartyTypeDebSec =

"Debtor";

 

results.PartyTypeIndOrg =

"ind";

 

results.PostalCode =

"27518";

 

results.SearchFilingLapseStatus =

"accepted";

 

results.State =

"NC";

 

results.Suffix =

"Mr";

 

searchresults.Add(results);

 

}

 

return searchresults;

 

}

}

 

public class UCCSearchResults

 

{

 

#region

 

Private Fields

 

 

private bool _isIndividual = true;

 

 

private string _PartyTypeIndOrg = String.Empty;

 

 

private string _PartyTypeDebSec = String.Empty;

 

 

private string _OrganizationName = String.Empty;

 

 

private string _FirstName = String.Empty;

 

 

private string _MiddleName = String.Empty;

 

 

private string _LastName = String.Empty;

 

 

private string _FullPartyName = String.Empty;

 

 

private string _Suffix = String.Empty;

 

 

private string _Address1 = String.Empty;

 

 

private string _City = String.Empty;

 

 

private string _State = String.Empty;

 

 

private string _County = String.Empty;

 

 

private string _Country = String.Empty;

 

 

private string _PostalCode = String.Empty;

 

 

private DateTime? _fileDate;

 

 

private DateTime? _lapsedDate;

 

 

private int _filingID = 0;

 

 

private int _lobTypeID = 0;

 

 

private int? _documentID = 0;

 

 

private int? _documentVersion = 0;

 

 

private int? _documentPageCount = 0;

 

 

private string _initialFileNumber = string.Empty;

 

 

private string _fileNumber = string.Empty;

 

 

private string _searchFilingLapseStatus = string.Empty;

 

#endregion

#region

 

Properties

 

 

/// <summary>

 

 

/// The lnFiling FilingID

 

 

/// </summary>

 

 

 

public int FilingID

 

{

 

get

 

{

 

return _filingID;

 

}

 

set

 

{

_filingID =

value;

 

}

}

 

/// <summary>

 

 

/// The lnFiling LOBTypeID

 

 

/// </summary>

 

 

 

public int LOBTypeID

 

{

 

get

 

{

 

return _lobTypeID;

 

}

 

set

 

{

_lobTypeID =

value;

 

}

}

 

/// <summary>

 

 

/// Is Individual. If false, it is an Organization.

 

 

/// </summary>

 

 

 

public bool IsIndividual

 

{

 

get

 

{

 

return _isIndividual;

 

}

 

set

 

{

_isIndividual =

value;

 

}

}

 

/// <summary>

 

 

/// Party Type - Either Individual or Organization

 

 

/// </summary>

 

 

 

public string PartyTypeIndOrg

 

{

 

get

 

{

 

return _PartyTypeIndOrg;

 

}

 

set

 

{

_PartyTypeIndOrg =

value;

 

}

}

 

/// <summary>

 

 

/// Party Type - Either Debtor or Secured Party

 

 

/// </summary>

 

 

 

public string PartyTypeDebSec

 

{

 

get

 

{

 

return _PartyTypeDebSec;

 

}

 

set

 

{

_PartyTypeDebSec =

value;

 

}

}

 

/// <summary>

 

 

/// Organization Name

 

 

/// </summary>

 

 

 

public string OrganizationName

 

{

 

get

 

{

 

return _OrganizationName;

 

}

 

set

 

{

_OrganizationName =

value;

 

}

}

 

/// <summary>

 

 

/// Individual's First Name

 

 

/// </summary>

 

 

 

public string FirstName

 

{

 

get

 

{

 

return _FirstName;

 

}

 

set

 

{

_FirstName =

value;

 

}

}

 

/// <summary>

 

 

/// Individual's Last Name

 

 

/// </summary>

 

 

 

public string LastName

 

{

 

get

 

{

 

return _LastName;

 

}

 

set

 

{

_LastName =

value;

 

}

}

 

/// <summary>

 

 

/// Individual's Middle Name

 

 

/// </summary>

 

 

public string MiddleName

 

{

 

get

 

{

 

return _MiddleName;

 

}

 

set

 

{

_MiddleName =

value;

 

}

}

 

/// <summary>

 

 

/// Individual's Suffix

 

 

/// </summary>

 

 

 

public string Suffix

 

{

 

get

 

{

 

return _Suffix;

 

}

 

set

 

{

_Suffix =

value;

 

}

}

 

/// <summary>

 

 

/// Party's Full Name. If it is an Individual, this is "Last, First Middle, Suffix". If it is an Organization, it is just "Organization Name"

 

 

/// </summary>

 

 

 

public string FullPartyName

 

{

 

get

 

{

 

return _FullPartyName;

 

}

 

set

 

{

_FullPartyName =

value;

 

}

}

 

/// <summary>

 

 

/// Individual's First Name

 

 

/// </summary>

 

 

 

public string Address1

 

{

 

get

 

{

 

return _Address1;

 

}

 

set

 

{

_Address1 =

value;

 

}

}

 

/// <summary>

 

 

/// City

 

 

/// </summary>

 

 

 

public string City

 

{

 

get

 

{

 

return _City;

 

}

 

set

 

{

_City =

value;

 

}

}

 

/// <summary>

 

 

/// State

 

 

/// </summary>

 

 

 

public string State

 

{

 

get

 

{

 

return _State;

 

}

 

set

 

{

_State =

value;

 

}

}

 

/// <summary>

 

 

/// County

 

 

/// </summary>

 

 

 

public string County

 

{

 

get

 

{

 

return _County;

 

}

 

set

 

{

_County =

value;

 

}

}

 

/// <summary>

 

 

/// Country

 

 

/// </summary>

 

 

 

public string Country

 

{

 

get

 

{

 

return _Country;

 

}

 

set

 

{

_Country =

value;

 

}

}

 

/// <summary>

 

 

/// Postal Code

 

 

/// </summary>

 

 

 

public string PostalCode

 

{

 

get

 

{

 

return _PostalCode;

 

}

 

set

 

{

_PostalCode =

value;

 

}

}

 

/// <summary>

 

 

/// Document ID of the document connected to the filing.

 

 

/// </summary>

 

 

 

public int? DocumentID

 

{

 

get

 

{

 

return _documentID;

 

}

 

set

 

{

_documentID =

value;

 

}

}

 

/// <summary>

 

 

/// Latest Document Version of the document connected to the filing.

 

 

/// </summary>

 

 

public int? DocumentVersion

 

{

 

get

 

{

 

return _documentVersion;

 

}

 

set

 

{

_documentVersion =

value;

 

}

}

 

/// <summary>

 

 

/// Page count of the document connected to the filing.

 

 

/// </summary>

 

 

 

public int? DocumentPageCount

 

{

 

get

 

{

 

return _documentPageCount;

 

}

 

set

 

{

_documentPageCount =

value;

 

}

}

 

/// <summary>

 

 

/// The Filing's Initial File Number

 

 

/// </summary>

 

 

 

public string InitialFileNumber

 

{

 

get

 

{

 

return _initialFileNumber;

 

}

 

set

 

{

_initialFileNumber =

value;

 

}

}

 

/// <summary>

 

 

/// The Filing's File Number

 

 

/// </summary>

 

 

 

public string FileNumber

 

{

 

get

 

{

 

return _fileNumber;

 

}

 

set

 

{

_fileNumber =

value;

 

}

}

 

/// <summary>

 

 

/// The lapse status of the filings being searched on.

 

 

/// </summary>

 

 

 

public string SearchFilingLapseStatus

 

{

 

get

 

{

 

return _searchFilingLapseStatus;

 

}

 

set

 

{

_searchFilingLapseStatus =

value;

 

}

}

 

/// <summary>

 

 

/// The lapse status of the filings being searched on.

 

 

/// </summary>

 

 

 

public DateTime? FileDate

 

{

 

get

 

{

 

return _fileDate;

 

}

 

set

 

{

_fileDate =

value;

 

}

}

 

/// <summary>

 

 

/// The lapse status of the filings being searched on.

 

 

/// </summary>

 

 

 

public DateTime? LapsedDate

 

{

 

get

 

{

 

return _lapsedDate;

 

}

 

set

 

{

_lapsedDate =

value;

 

}

}

#endregion

}

}




 

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 01 Apr 2010, 04:09 PM
Hi Chinna,

I reviewed the code, and it looks correct. If the issue persists, you can open a formal support ticket, and send us a small working project, demonstrating your setup, and showing the unwanted behavior.
We will debug it locally, and get back to you with additional information on the matter.

Meanwhile, you can examine the following online example which handles the desired functionality and let me know if it helps:
Advanced Data Binding

Greetings,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
chinna
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or