asp.net mvc - MVC routing issue when use url.action -
i have javascript file following url.action defined within view
var url = '@url.action("getsomething", "somecontroller", new { area = "", repository = model.repository, multiselect = model.multiselect })';
in javascript load using url object defined above , following url
/employeerepository/gettree?multiselect=true/1
my causes issue because url not correctly map routing config is:
routes.maproute("hierarchymultiselect", "{repository}/{action}/{id}/{multiselect}", new { controller = "somecontroller", id = urlparameter.optional, multiselect = urlparameter.optional }, new { repository = @"\w*repository$" }, namespaces);
it works if url
/employeerepository/gettree/1/true
so wanted know how can url in format javascript following:
stafftree.load(url + "/" + id, function () {}
would better use route data using parameters or sort url in javascript?
thanks in advance
may i'm wrong, actionresult isn't set in routing. mind should add action = "gettree"
statement route:
routes.maproute( name: "hierarchymultiselect", url: "{repository}/{action}/{id}/{multiselect}", defaults: new { controller = "somecontroller", action = "gettree", id = urlparameter.optional, multiselect = urlparameter.optional }, new { repository = @"\w*repository$" }, namespaces);
Comments
Post a Comment