this controller:
public actionresult showmenu(string id) { viewbag.id = id; return view(id); } i creating different webpages based on different menus.. view created:
<div class="test"> @foreach (datarow dr in ds.tables[0].rows) { <ul> <li>@html.actionlink("test", "showmenu", routevalues: new {id = "test" })</li> </ul> } </div> so created view showmenu.. problem is: how can create multiple webpages id's? domain looks mydomain.com/showmenu/test
the test change different values loop keeps iterating, , need create different webpages each of id parameters.
i want use showmenu view, , through that, dynamically change webpage based on id parameter
you'll need use property datarow, how access dr["id"] below.
<div class="test"> @foreach (datarow dr in ds.tables[0].rows) { <ul> <li>@html.actionlink("test", "showmenu", routevalues: new {id = dr["id"] })</li> </ul> } </div> by way, passing datatables view isn't common in mvc i'm aware of. instead, typically describe model , pass that. example
public class product { public int id {get; set;} public string name {get; set;} } public actionresult list() { list<product> products = database.getproducts(); return view(products); } public actionresult details(string id) { product product = database.getproducts().where(p => p.id == id).single(); return view(product); }
Comments
Post a Comment