asp.net mvc 4 - Binding Gridview with drop down list selection MVC 5 -
asp.net mvc 4 - Binding Gridview with drop down list selection MVC 5 -
i have drop downwards list (cities) , on selection should able bind grid view in mvc 5
i able bind drop downwards list , grid view unable handle select event of drop downwards list. dont know how proceed on dont want utilize jquery. below code
// below drop downwards list code
@using (html.beginform("bindgridview", "facebookconfig", formmethod.post, new { id = "id" })) { @html.dropdownlist("cities") }// on selection of above should able bind below grid view
@if (model != null) { foreach (var item in model) { @html.displayfor(modelitem => item.keywords) @html.actionlink("edit", "edit", new { id = item.id }) @html.actionlink("delete", "delete", new { id = item.id })// below code in controller
public actionresult index() { var cities = so.bl.city.getcities(); viewbag.cities = new selectlist(cities, "id", "name"); homecoming view(); } [httppost] public actionresult bindgridview(int id) { var filter = so.bl.facebookfilter.selectfbapprovalfilters(id); homecoming view(filter); }
if want perform operation on dropdown on alter event must go javascript/jquery handling element events. satisfy requirement may as,
create<div>
hold new grid view created id select. create partial view generate grid view. create function either in jquery/javascript dropdown list on alter event. from function phone call action method using ajax. create action method ever functionality want , homecoming partial view model required generating grid view. finally on success method of ajax call, write output response inner html of <div>
. if not going jquery or javascript post , selected dropdown value in post method fetch info grid view , bind grid. note here form submission not occur on dropdown selection must utilize submit button. show grid based model if not null.
choose 1 adopt.
asp.net-mvc-4 model-view-controller
Comments
Post a Comment