hello
i am trying to implement a radgrid with filtering controls; one (or more, hopefully) column should be filtered using a checkbox list
here is the ascx code:
<
telerik:RadGrid
runat
=
"server"
AllowFilteringByColumn
=
"True"
FilterType
=
"Combined"
DataSourceID
=
"SqlDataSource1"
AllowPaging
=
"True"
PageSize
=
"10"
CellSpacing
=
"0"
GridLines
=
"None"
Skin
=
"Bootstrap"
HeaderStyle-Font-Bold
=
"true"
AutoGenerateColumns
=
"False"
ID
=
"subFilesGrid"
EnableViewState
=
"true"
OnPageIndexChanged
=
"subFilesGrid_OnPageIndexChanged"
onitemcommand
=
"subFilesGrid_ItemCommand"
OnFilterCheckListItemsRequested
=
"subFilesGrid_FilterCheckListItemsRequested"
>
<
MasterTableView
DataKeyNames
=
"nome"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
></
CommandItemSettings
>
<
RowIndicatorColumn
Visible
=
"True"
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
Visible
=
"True"
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridButtonColumn
Text
=
"Download"
CommandName
=
"dloadFile"
UniqueName
=
"dcCol"
></
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"originalname"
HeaderText
=
"File Name"
UniqueName
=
"FileName"
HeaderStyle-Width
=
"150px"
AllowFiltering
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"dinfo"
HeaderText
=
"Description"
HeaderStyle-Width
=
"180px"
UniqueName
=
"column"
AllowFiltering
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FileType"
HeaderText
=
"File Type"
HeaderStyle-Width
=
"150px"
UniqueName
=
"FileType"
FilterCheckListEnableLoadOnDemand
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"date"
HeaderText
=
"Submission Date"
HeaderStyle-Width
=
"180px"
PickerType
=
"DatePicker"
FilterDateFormat
=
"yyyy-MM-dd"
DataFormatString
=
"{0:yyyy-MM-dd HH:mm}"
>
</
telerik:GridDateTimeColumn
>
<
telerik:GridTemplateColumn
DataField
=
"sName"
HeaderText
=
"Submitter"
UniqueName
=
"column2"
>
<
ItemTemplate
>
<%# SetSubmitter(Eval("sName"))%>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"status"
HeaderText
=
"Status"
UniqueName
=
"column3"
>
<
ItemTemplate
>
<%# SetStatus(Eval("status"))%>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
></
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
>
<
WebServiceSettings
>
<
ODataSettings
InitialContainerName
=
""
></
ODataSettings
>
</
WebServiceSettings
>
</
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
<
WebServiceSettings
>
<
ODataSettings
InitialContainerName
=
""
></
ODataSettings
>
</
WebServiceSettings
>
</
HeaderContextMenu
>
</
telerik:RadGrid
>
and here is code-behind for filling the checkbox list
protected void subFilesGrid_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
{
string DataField = (e.Column as IGridDataColumn).GetActiveDataField();
e.ListBox.Items.Clear();
e.ListBox.AppendDataBoundItems = false;
/*e.ListBox.DataSource = GetDataTable(DataField);
e.ListBox.DataKeyField = DataField;
e.ListBox.DataTextField = DataField;
e.ListBox.DataValueField = DataField;
e.ListBox.DataBind();*/
string query = "SELECT type as FileType FROM [ICOS].[dbo].[FileType] where id_filetype!=20";
// string.Format("SELECT type as FileType FROM [ICOS].[dbo].[FileType] where id_filetype!=20", field);
SqlConnection cn = new SqlConnection(conn);
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = query;
SqlDataReader rd = cmd.ExecuteReader();
while (rd.Read())
{
e.ListBox.Items.Add(new RadListBoxItem(rd["FileType"].ToString()));
}
e.ListBox.DataTextField = DataField;
e.ListBox.DataValueField = DataField;
e.ListBox.DataBind();
rd.Close();
cn.Close();
e.ListBox.ShowCheckAll = false;
}
now, when loading the page, an unexpected item is displayed: ResourceNotFound#CheckListBox:CheckAll (you can see it here)
i have followed the steps showed in this page
Thanx in advance
Diego