Hi, I'm using raddatapager for my radlistview, the paging function works fine and filter functions works fine, as long as you don't use them at the same time. but all the paging function stops working after filterexpression gets call, here is source code:
aspx:
<telerik:RadListView ID="RadListView1" runat="server" ItemPlaceholderID="ItemContainer"
AllowPaging="True" DataSourceID="LinqDataSource1"
OnDataBound="RadListView1_DataBound">
<LayoutTemplate>
<asp:PlaceHolder ID="ItemContainer" runat="server" />
<div class="test">
<telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
EnableEmbeddedBaseStylesheet="false" PageSize="15" BackColor="#EEF5FB" BorderWidth="0"
EnableEmbeddedSkins="false" EnableTheming="false" CssClass="pp">
<Fields>
<telerik:RadDataPagerButtonField FieldType="Prev" />
<telerik:RadDataPagerButtonField FieldType="Next" />
<telerik:RadDataPagerTemplatePageField>
<PagerTemplate>
<asp:Button runat="server" ID="previousButton" CommandName="Page" CommandArgument="Previous"
Text="Previous" CssClass="PagerButton NextPage previousArrow" />
</PagerTemplate>
</telerik:RadDataPagerTemplatePageField>
<telerik:RadDataPagerButtonField FieldType="Numeric" />
<telerik:RadDataPagerTemplatePageField>
<PagerTemplate>
<asp:Button runat="server" ID="nextButton" CommandName="Page" CommandArgument="Next"
Text="Next" CssClass="PagerButton NextPage linkArrow" />
</PagerTemplate>
</telerik:RadDataPagerTemplatePageField>
</Fields>
</telerik:RadDataPager>
</div>
</LayoutTemplate>
<ItemTemplate>
<div class="resourceItemHeader">
<asp:HyperLink ID="HeaderLink" runat="server" Target="_blank" Text='<%#Eval("Name") %>'
NavigateUrl='<%#Eval("Url") %>'></asp:HyperLink>
</div>
</ItemTemplate>
</telerik:RadListView>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MHBCore.Data.MHBCoreDataContext"
EntityTypeName="" TableName="ViewResourceItemJoinCategory">
</asp:LinqDataSource>
aspx.cs
public int TypeId { get; set; }
public int TopicId { get; set; }
public int ExamId { get; set; }
public string SearchKey { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadListView1.CurrentPageIndex = 0;
Load();
}
}
public void Load()
{
RadListView1.FilterExpressions.Clear();
if (TypeId > 0)
RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("ResourceTypeId") { CurrentValue = TypeId });
if (TopicId > 0)
RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("TopicId") { CurrentValue = TopicId });
if (ExamId > 0)
RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("CategoryId") { CurrentValue = ExamId });
if (!string.IsNullOrWhiteSpace(SearchKey))
RadListView1.FilterExpressions.BuildExpression(expression => expression.Contains("Name", SearchKey).Or().Contains("TopicName", SearchKey).Or().Contains("Description", SearchKey));
else
RadListView1.FilterExpressions.BuildExpression();
RadListView1.Rebind();
RadListView1.FindControl("RadDataPager1").Visible = RadListView1.PageCount > 1;
}
I got an javascript error, after I clicked "next" button:
Error: Sys.WebForms.PageRequestManagerServerErrorException: Identifier expected
Source File: http://localhost:90/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_Header1_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ac9d03845-da3c-45e9-ab05-79ee502af576%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.826.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ad48d12ba-bfe2-4fcc-856e-a7c7557f0453%3a16e4e7cd%3addbfcb67%3a4a0008d8
Line: 15
aspx:
<telerik:RadListView ID="RadListView1" runat="server" ItemPlaceholderID="ItemContainer"
AllowPaging="True" DataSourceID="LinqDataSource1"
OnDataBound="RadListView1_DataBound">
<LayoutTemplate>
<asp:PlaceHolder ID="ItemContainer" runat="server" />
<div class="test">
<telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
EnableEmbeddedBaseStylesheet="false" PageSize="15" BackColor="#EEF5FB" BorderWidth="0"
EnableEmbeddedSkins="false" EnableTheming="false" CssClass="pp">
<Fields>
<telerik:RadDataPagerButtonField FieldType="Prev" />
<telerik:RadDataPagerButtonField FieldType="Next" />
<telerik:RadDataPagerTemplatePageField>
<PagerTemplate>
<asp:Button runat="server" ID="previousButton" CommandName="Page" CommandArgument="Previous"
Text="Previous" CssClass="PagerButton NextPage previousArrow" />
</PagerTemplate>
</telerik:RadDataPagerTemplatePageField>
<telerik:RadDataPagerButtonField FieldType="Numeric" />
<telerik:RadDataPagerTemplatePageField>
<PagerTemplate>
<asp:Button runat="server" ID="nextButton" CommandName="Page" CommandArgument="Next"
Text="Next" CssClass="PagerButton NextPage linkArrow" />
</PagerTemplate>
</telerik:RadDataPagerTemplatePageField>
</Fields>
</telerik:RadDataPager>
</div>
</LayoutTemplate>
<ItemTemplate>
<div class="resourceItemHeader">
<asp:HyperLink ID="HeaderLink" runat="server" Target="_blank" Text='<%#Eval("Name") %>'
NavigateUrl='<%#Eval("Url") %>'></asp:HyperLink>
</div>
</ItemTemplate>
</telerik:RadListView>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MHBCore.Data.MHBCoreDataContext"
EntityTypeName="" TableName="ViewResourceItemJoinCategory">
</asp:LinqDataSource>
aspx.cs
public int TypeId { get; set; }
public int TopicId { get; set; }
public int ExamId { get; set; }
public string SearchKey { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadListView1.CurrentPageIndex = 0;
Load();
}
}
public void Load()
{
RadListView1.FilterExpressions.Clear();
if (TypeId > 0)
RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("ResourceTypeId") { CurrentValue = TypeId });
if (TopicId > 0)
RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("TopicId") { CurrentValue = TopicId });
if (ExamId > 0)
RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("CategoryId") { CurrentValue = ExamId });
if (!string.IsNullOrWhiteSpace(SearchKey))
RadListView1.FilterExpressions.BuildExpression(expression => expression.Contains("Name", SearchKey).Or().Contains("TopicName", SearchKey).Or().Contains("Description", SearchKey));
else
RadListView1.FilterExpressions.BuildExpression();
RadListView1.Rebind();
RadListView1.FindControl("RadDataPager1").Visible = RadListView1.PageCount > 1;
}
I got an javascript error, after I clicked "next" button:
Error: Sys.WebForms.PageRequestManagerServerErrorException: Identifier expected
Source File: http://localhost:90/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_Header1_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ac9d03845-da3c-45e9-ab05-79ee502af576%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.826.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ad48d12ba-bfe2-4fcc-856e-a7c7557f0453%3a16e4e7cd%3addbfcb67%3a4a0008d8
Line: 15