c# - How to call parameterized Index Action in mvc3? -
public actionresult index(int id) { list<tablename> llistsong = new list<tablename>(); using (dbname dbcontext=new dbname ()) { llistsong = (from z in dbcontext.tablenamewhere z.songid ==id select z).tolist(); } foreach (var songchooesen in llistsong) { viewbag.selectedsong = songchooesen.songname.tostring(); } return view("index"); }
this action has been defined in abccontrollers , want access action using url www.urlname/abc/12 not accessible. have used concept of routing in mvc3. please me
you can try following route
,
routes.maproute( "abc_details", "abccontroller/{id}", new { controller = "abccontroller", action = "index" } );
Comments
Post a Comment