如何使用C#动态地将值添加到过滤器中? [英] How to add a value into filter dynamically using C#?

查看:119
本文介绍了如何使用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[^].
Quote:

该示例演示了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).


这篇关于如何使用C#动态地将值添加到过滤器中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆