Hello,
I am using a "Combined" filter type on a RadGrid and some of my columns use the CheckList filter like the one shown below.
<
telerik:GridBoundColumn
DataField
=
"State"
HeaderText
=
"State"
ReadOnly
=
"true"
HeaderStyle-Width
=
"40px"
FilterControlWidth
=
"40px"
ItemStyle-Width
=
"40px"
AutoPostBackOnFilter
=
"true"
UniqueName
=
"State"
SortExpression
=
"State"
FilterCheckListEnableLoadOnDemand
=
"false"
FilterControlAltText
=
"Filter State column"
CurrentFilterFunction
=
"StartsWith"
/>
We are using a persistence manager to restore the state of the grid, sometimes this includes values that were checked in the column above. When restoring from the persistence manager, the grid is filtered correctly however, the values are not checked in the FilterCheckList.
I tried checking the values in the DataBound event handler for the list box and the values get selected correctly but not checked correctly.
private
void
ListBox_DataBound(
object
sender, EventArgs e)
{
RadListBox listBox = sender
as
RadListBox;
string
filter = grdOpportunities.MasterTableView.FilterExpression;
filter = filter.Replace(
"AND"
,
"&"
);
string
[] filters = filter.Split(
'&'
);
foreach
(
string
f
in
filters)
{
if
(f.Contains(listBox.DataKeyField))
{
string
current = f.Replace(
"OR"
,
"&"
);
string
[] options = current.Split(
'&'
);
foreach
(
string
o
in
options)
{
foreach
(RadListBoxItem item
in
listBox.Items)
{
if
(o.Contains(item.DataKey.ToString()))
{
item.Selected =
true
;
item.Checked =
true
;
}
}
}
}
}
}
Please advise, thank you!