Saturday, 17 August 2013

How do I create a url with a bookmark in MVC

How do I create a url with a bookmark in MVC

I want to have a link to the knowledge base but I want to also create the
bookmark using the id attribute.
// var url = "/KnowledgeBase/Index#Bookmark"
so in my view I want to add that bookmark using the value from my model
var url = Url.Content(string.Concat(Url.Action("Index", "KnowledgeBase"),
"#", Model.Bookmark));
This doesn't seem elegant. Is there a better way?

No comments:

Post a Comment