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

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -