views:

48

answers:

1

i call page like host/home/controller/id. now in view i want to get 'id', i do it like this

ViewContext.RouteData.Values["id"]

is any other short way?

A: 

The best place to retrieve it would be in your Model... if present, which I think it alway should...

moi_meme
but if i need write link <%= Html.ActionLink("Галереи", "GalleryList", "Admin", new { id = ViewContext.RouteData.Values["id"] }, null)%>
kusanagi
<%= Html.ActionLink("Галереи", "GalleryList", "Admin", new { id = model.Id }, null)%>
moi_meme