javascript - Best way to filter a list-view in asp.net MVC -


i have list of data coming database , displaying in table, works how want.

what do, add dropdownlist page "filters" data in table, based on value of selected item in dropdonwlist.

for example, dropdown has these values

assigned me assigned others 

and list of data, has "assignedto" field. when value in dropdown changes, update list of data.

in webforms, use updatepanel , dropdownlist autopostback=true, how can same effect in mvc?

you use javascript/jquery bind onchange/onclick event, , there postback:

$(function() {    $("#myelement").click(function(){       $("#secondelement").load('<%= url.action("source") %>?selected=' + $(this).val());    }); } 

there're jquery plugins similar things, example http://dev.chayachronicles.com/jquery/cascade/index.html (not best one, first found).


Comments

Popular posts from this blog

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -