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

RadFilterDataFieldEditor with FilterContainerID sets

2 Answers 86 Views
Filter
This is a migrated thread and some comments may be shown as answers.
JiriSchmitt
Top achievements
Rank 1
JiriSchmitt asked on 14 Jan 2011, 05:11 PM
Hello,

I have created RadFilterDataFieldEditor by following article: http://www.telerik.com/community/forums/aspnet-ajax/filter/error-when-building-custom-radfilterdatafieldeditor.aspx
It works good if the FilterContainerID property is not set. If I set this property to my RadGrid it does not work correctly.
Editor is shown ok if I add filter expression, but after I click the Apply button, default editor is shown instead RadFilterDataFieldEditor. After next postback I get error with invalid viewstate data.

Here is the Code:
<telerik:RadFilter runat="server" ID="filter" FilterContainerID="articles" ShowApplyButton="true"
    OnFieldEditorCreating="filter_FieldEditorCreating">
    <FieldEditors>
        <telerik:RadFilterTextFieldEditor FieldName="Title" />
        <km:RadFilterDropDownEditor DataSourceID="dsStates" DataTextField="Name" DataValueField="ArticleStatusId"
            FieldName="StatusId" />
        <telerik:RadFilterTextFieldEditor FieldName="AuthorFullName" />
        <telerik:RadFilterNumericFieldEditor FieldName="Rating" />
        <telerik:RadFilterNumericFieldEditor FieldName="TimesRated" />
        <telerik:RadFilterDateFieldEditor FieldName="CreatedDate" />
        <telerik:RadFilterDateFieldEditor FieldName="ModifiedDate" />
    </FieldEditors>
</telerik:RadFilter>
<telerik:RadGrid ID="articles" runat="server" OnNeedDataSource="articles_NeedDataSource"
    EnableLinqExpressions="false" ShowFooter="True" AllowFilteringByColumn="True"
    AllowSorting="True" ShowGroupPanel="True" AllowPaging="true" PageSize="10">
    <MasterTableView AutoGenerateColumns="False" EnableHeaderContextMenu="true" IsFilterItemExpanded="false">
        <Columns>
            <telerik:GridBoundColumn DataField="Title" HeaderText="Title" />
            <telerik:GridDropDownColumn DataField="StatusId" HeaderText="Status" DataSourceID="dsStates" ListTextField="Name" ListValueField="ArticleStatusId" />
            <telerik:GridBoundColumn DataField="AuthorFullName" HeaderText="Author" />
            <telerik:GridBoundColumn DataField="Rating" HeaderText="Rating" />
            <telerik:GridBoundColumn DataField="TimesRated" HeaderText="TimesRated" />
            <telerik:GridBoundColumn DataField="CreatedDate" HeaderText="Created" />
            <telerik:GridBoundColumn DataField="ModifiedDate" HeaderText="Modified" />
        </Columns>
    </MasterTableView>
    <GroupingSettings ShowUnGroupButton="true" CaseSensitive="false" />
    <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" />
</telerik:RadGrid>

Codebehind:
protected void filter_FieldEditorCreating(object sender, RadFilterFieldEditorCreatingEventArgs e)
{
    if (e.EditorType == "RadFilterDropDownEditor")
    {
        e.Editor = new RadFilterDropDownEditor();
    }
}

Thank you
Jiri

2 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 20 Jan 2011, 10:28 AM
Hi Jiri,

I am afraid that with custom editors RadFilter does not support automatically filtering on container. You should manually apply the expressions to RadGrid. For your convenience I am attaching sample app demonstrating how to achieve this.

Kind regards,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
JiriSchmitt
Top achievements
Rank 1
answered on 20 Jan 2011, 10:41 AM
Hi Maria,

It works.

Thank you
Jiri
Tags
Filter
Asked by
JiriSchmitt
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
JiriSchmitt
Top achievements
Rank 1
Share this question
or