How should I cleanly track selected item in ASP.NET MVC?
Posted
by
Aaron Anodide
on Stack Overflow
See other posts from Stack Overflow
or by Aaron Anodide
Published on 2012-08-30T00:52:29Z
Indexed on
2012/08/30
9:38 UTC
Read the original article
Hit count: 247
c#
|asp.net-mvc
Is there a better way to track the selected item than how I do it in the code below which implements a row of navigation links.
@Html.ActionLink(
"PreApproval",
"Summary",
new { mode = "preapproval" },
new { @class = Model.Mode == "preapproval" ? "selected" : "notselected" }) |
@Html.ActionLink(
"ActionNeeded",
"Summary",
new { mode = (string)null },
new { @class = string.IsNullOrWhiteSpace(Model.Mode) ? "selected" : "notselected" }) |
...
Should I try to encasulate the functionality of menu navigation or is this a standard approach?
© Stack Overflow or respective owner