RadGrid drop-down filter with multi-select
Hi,
I am currently using a RadGrid with drop-down filter similar to the one from this example :
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx .
I currently use GridTemplateColumn like this :
<
telerik:GridTemplateColumn
UniqueName
=
"Region"
DataField
=
"Region"
HeaderText
=
"Region"
SortExpression
=
"Region"
FilterControlWidth
=
"40%"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"EqualTo"
>
<
HeaderStyle
Width
=
"9%"
/>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"regionFilterCombo"
runat
=
"server"
Width
=
"100%"
AutoPostBack
=
"true"
Sort
=
"Ascending"
SortCaseSensitive
=
"false"
AllowCustomText
=
"true"
Height
=
"120px"
OnSelectedIndexChanged
=
"FilterRegion"
>
</
telerik:RadComboBox
>
</
FilterTemplate
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblRegion"
Text='<%# Eval("Region")%>'>
</
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
private
void
BindFilter(RadComboBox filterCombo, List<
string
> items,
string
filterValue)
if
(items.Contains(
string
.Empty))
items.Remove(
string
.Empty);
filterCombo.DataSource = items;
filterCombo.Sort = RadComboBoxSort.Ascending;
filterCombo.DataBind();
filterCombo.Items.Sort();
filterCombo.SelectedValue = filterValue;
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"regionFilterCombo"
runat
=
"server"
Width
=
"100%"
AutoPostBack
=
"true"
Sort
=
"Ascending"
SortCaseSensitive
=
"false"
AllowCustomText
=
"true"
Height
=
"120px"
DataValueField
=
"Region"
OnSelectedIndexChanged
=
"FilterRegion"
>
<
ItemTemplate
>
<
div
onclick
=
"StopPropagation(event)"
>
<
asp:CheckBox
runat
=
"server"
ID
=
"chk1"
Checked
=
"false"
/>
<
asp:Label
runat
=
"server"
ID
=
"Label1"
AssociatedControlID
=
"chk1"
Text='<%# Eval("Region")%>' />
</
div
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
</
FilterTemplate
>
Hi Morty,
The project in the code library below shows how you could use Multi-Selection RadComboBox (with
checkboxes in ItemTemplate) in the FilterTemplate of RadGrid. Give it a try and see if it works for you:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/multi-selection-radcombobox-for-filtering-grid.aspx
Kind regards,
Pavlina
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Hi Pavlina,
Thanks for the quick reply. I solved my problem using a similar aproach (using an ItemTemplate).
Hi,
We have a similar requirement of using multi select list as a filter option inside grid. We are using MVC3 razor. Is this RadGrid with multiselect dropdown(as discussed in same post) supports MVC3(our requirement).
Hi Susheel,
If you have any questions about our MVC extensions you can open a support ticket or write in the MVC forums.
All the best,
Pavlina
the Telerik team
HI Pavlina,
I Have dynamically generated RadGrid with Template filter columns .
I can only filter with RadComboBox and i want filter this with multiple radcomboBox ....
all these combo and rad grid is dynamically generated.
Hello Rohan,
I am afraid that I can not understand what exactly you want to achieve. Can you please elaborate a bit more in the details? What you mean by "I can only filter with RadComboBox and i want filter this with multiple radcomboBox"?
Greetings,
Pavlina
the Telerik team
Hello,
What you can do is to open a formal support ticket and send us the problematic project there for further investigation. Thus we will be able to observe the described issue and advice you further.
Greetings,
Pavlina
the Telerik team