By Using MVC4 ,JQuery,And Nhibernate
sample Code
sample Code
//Script Block
$(function () {
$("#resourceSelectList").change(function () {
var urlAction = "~/Planner/LoadPlannerWithFilter?value=";
var value = $(this).val();
});
});
@*HTML Markup*@
@Html.DropDownListFor(x => x.resourceSelectList, Model.resourceSelectList)
And Cotroller Part
public ActionResult PlannerLanding()
{
WrapperClass wrp = new WrapperClass();
var resourceSelectList = obj.getResourceList()
.Select(x => new SelectListItem
{
Value = x.Owner,
Text = x.Owner
});
wrp.resourceSelectList = new SelectList(resourceSelectList,
"Value", "Text");
return View(wrp);
}
/*
*This action method is getting called when the drop down value changes.
*/
public ActionResult LoadPlannerWithFilter(string value)
{
WrapperClass wrp = new WrapperClass();
var resourceSelectList = obj.getResourceList()
.Select(x => new SelectListItem
{
Value = x.Owner,
Text = x.Owner
});
wrp.resourceSelectList = new SelectList(resourceSelectList,
"Value", "Text");
return View("PlannerLanding",wrp);
}
Comments
Post a Comment