c# - ActionLink with multiple parameters doesnt work -
my routing looks this:
routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } );
this link after clicking should redirect appropriate id action index. action index located in controller: kursymanage.
columns.add() .encoded(false) .sanitized(false) .setwidth(10) //text //action //controller .rendervalueas(c => html.actionlink("zarzadzaj", "index", "kursymanage", new { id = c.id }, null));
unfortunately, action index gets empty value (null). in case when not use name of controller, works fine.
public actionresult index(int? pidkursu) { var schemalist = (from scheme in szkolajezykowadb.kursyusers scheme.kursid == pidkursu && scheme.czyzapisany == 0 select scheme).tolist(); return view(schemalist); }
could please advice me made mistake?
change name of parameter in index method match value setting in view.
public actionresult index(int? id) { var schemalist = (from scheme in szkolajezykowadb.kursyusers scheme.kursid == id && scheme.czyzapisany == 0 select scheme).tolist(); return view(schemalist); }
Comments
Post a Comment