如何使用C#动态地将值添加到过滤器中?
我有一个带有过滤器的radGridView用于每一列。
现在我的问题是在绑定gridview时我想为一个值添加一个值指定的列和gridview必须通过基于给定的值进行过滤来显示。
Hi,
I have a radGridView with filter for each column .
Now my problem is at the time of binding the gridview i want to add a value to the specified column and the gridview has to be displayed by filtering based on the value given.
List<SpGetAllExamTypes_Result> lstExamTypes = objMdlClass.GetAllExamTypes(null).FindAll(F=>F.ExamName == ExamName);
foreach (SpGetAllExamTypes_Result objExam in lstExamTypes)
{
ExamId = objExam.ExamTypeId;
}
List<SpGetConsolidatedExamReport_Result> lstexamMarks = objManage.GetExamAnalysisReport(
Convert.ToInt32(CourseId), ExamId,
ddlMasterAcademicYear.SelectedValue).FindAll(F=>F.SubjectId==Convert.ToInt32(SubjectId));
gvAnalysisView.DataSource = lstexamMarks;
gvAnalysisView.DataBind();
这是我的代码
这里我在基于subjectId的列表中找到但我不想在列表中找到我想要将subjectId添加到过滤器并且必须过滤gridview.
任何人都可以帮助我?
this my code
here i am finding in the list based on subjectId but i do not want to find in the list i want to add the subjectId to the filter and the gridview have to be filtered.
can anyone help me?
查看演示网格 - 基本过滤 [ ^ ]。
Have a look at the demo Grid - Basic Filtering[^].
该示例演示了Telerik RadGrid的过滤功能。可以使用 RadGrid.AllowFilteringByColumn 或 GridTableView.AllowFilteringByColumn 属性启用/禁用过滤。然后,每个支持过滤的列(GridBoundColumn,GridCheckBoxColumn等)在相应的标题下面显示一个过滤器框。
用户可以根据相应列属性中指定的规则设置过滤器表达式: FilterFormatString,CurrentFilterFunction,CurrentFilterValue 。按下过滤器按钮(过滤器框旁边)后,网格仅显示符合过滤条件的记录(关于所有过滤器框的设置)。
The example demonstrates the filtering capabilities of Telerik RadGrid. Filtering can be enabled/disabled using RadGrid.AllowFilteringByColumn or GridTableView.AllowFilteringByColumn properties. Then each column that supports filtering (GridBoundColumn, GridCheckBoxColumn, etc) shows a filter box beneath the corresponding header.
User can set a filter expression based on the rules specified in the corresponding column properties: FilterFormatString, CurrentFilterFunction, CurrentFilterValue . After pressing the filter button (next to the filter box) the grid displays only the records matching the filter criteria (regarding the settings of all filter boxes).