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?

link|flag

1 Answer

up vote 0 down vote accepted

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

link|flag
but if i need write link <%= Html.ActionLink("Галереи", "GalleryList", "Admin", new { id = ViewContext.RouteData.Values["id"] }, null)%> – kusanagi Jun 21 at 17:48
<%= Html.ActionLink("Галереи", "GalleryList", "Admin", new { id = model.Id }, null)%> – moi_meme Jun 21 at 18:07

Your Answer

 
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.