asp.net mvc - Issue when submitting a param into controller -
this cannot figure out while:
in view wrote this:
@using(html.beginform("pindex","home")){ <select name ="particalview"> <option value="1">option 1</option> <option value="2">option 2</option> </select>
the controller behind is:
[httppost] public actionresult pindex(string i) { if (i == "1") viewbag.page = 1; else if(i == "2") viewbag.page = 2; if(i == null) viewbag.page = 3; return view(); }
whatever select, controller fails param of select list, can tell me missed?
change parameter in pindex particalview
[httppost] public actionresult pindex(string particalview) { if (particalview == "1") viewbag.page = 1; else if(particalview == "2") viewbag.page = 2; if(particalview == null) viewbag.page = 3; return view(); }
Comments
Post a Comment