filtering telerik mvc grid by Html.Telerik().DropDownList

扶醉桌前 提交于 2019-12-24 19:23:33

问题


Hi I would like to ask how can i filter the current contents of the Telerik mvc grid by the selected value in Html.Telerik().DropDownList?

I think there's some js scripts needed which I'm figuring out.

Thanks in advance.

-Lawrence


回答1:


In your dropdownlist's onchange event:

.ClientEvents(events => events
       .OnChange(
       @<text> function(e) { $('NameOfGrid').data('tGrid').rebind(); }
       </text>))

and in your grid's ondatabinding event:

.ClientEvents(e => e
            .OnDataBinding(
                @<text> function(a) { a.data = $.extend(a.data,{ dropdownlist: $('#dropdownlist').val()}); }
                </text>)
            )

In your controller, add the dropdownlist parameter to your GridAction and perform your action.



来源:https://stackoverflow.com/questions/11357333/filtering-telerik-mvc-grid-by-html-telerik-dropdownlist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!