I have a very large asp.NET MVC application and I'm looking for the most efficient way of accomplishing adding a help document to each view. So in essence,I have added a partial view inside of the layout; that gets called on every page, that invokes a helper method to get return a string and the string is just the URL of the help docs for that specific page.
This is One approach:
{Key: "User_Management", Value: "/Account/User/List"},
{Key: "User_Management_Edit", Value: "/Account/User/Edit"}
The Key would be what i'm looking for as part of the URL and the value would be the returned URL string. So if the URL is /User/Management/ Then the returned value would be the first of the list, /Account/User/List.
A second approach could be to store the keyUser_Management directly into the view as a ViewBag or ViewData and then check the value in the helper.
My only concern is that with approach One I would have to maintain the keys to make sure that they match the URL, and with approach Two, i'm wondering if it's inefficient to pass a string as a viewbag on each view.
Would love to hear some alternatives or if anyone has a better idea.
Aucun commentaire:
Enregistrer un commentaire