Operating with the FilterExpression of Telerik RadGrid Manually

http://www.telerik.com/help/aspnet-ajax/grid-operate-with-filter-expression-manually.htm

http://www.telerik.com/community/forums/aspnet/grid/multiple-selection-for-filter-column-radgrid.aspx

http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-set-filterexpression-manually-using-dates.aspx

Question

I have a scenario. In the RadGrid, i have a column with Job_Title. The filter works perfect with this column. But, I Donno how if i want to select two options for this column (Eg.,People who works in 2 departments say  Accountant & Process Engineer ).l


Answer

Unfortunately RadGrid doesn't support this feature out-of-the-box. But it can be implemented quite easy by using custom routine hooked on RadGrid's ItemCommand event to parse entered filter text and build your own filter expression.

I have attached you a basic example how this can be achieved. In attached project you have to enclose value with spaces in them with quotation marks when using between function.


Sample

http://www.telerik.com/help/aspnet-ajax/grid-custom-option-for-filtering.html

http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/selfreferencing/defaultcs.aspx

if  (Assembly.GetAssembly(typeof(ScriptManager)).FullName.IndexOf("3.5") != -1 || Assembly.GetAssembly(typeof(ScriptManager)).FullName.IndexOf("4.0") != -1)
            {
                RadGrid1.MasterTableView.FilterExpression = @"it[""ReportsTo""] = Convert.DBNull";
            }
             else
            {
                RadGrid1.MasterTableView.FilterExpression = "ReportsTo IS NULL";

            }


XXXDateTime.ToString() >= DateTime(2012,04,03) && XXXDateTime.ToString() <= DateTime(2012,08,06)

Note:
When applying the filter expression, can you please make sure that you have disabled the linq expressions (EnableLinqExpressions="false"). Let me know if this allows the filter expression to be properly applied. 
(http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-set-filterexpression-manually-using-dates.aspx)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值