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:
Codebehind:
Thank you
Jiri
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