Reputation: 11652
I am using same action method for Add
and Edit
. So I have an issue changing title of the breadcrumb. Now it is always showing Add Address when we do Edit. So is it possible to change Title
dynamically. Only change is Edit address will have parameter value AddressID
. How to change title dynamically?
[HttpGet]
[MvcSiteMapNode(Title = "Add Address", ParentKey = "Addresses", Key = "AddAddress")]
public ActionResult GetEditAddress(string AddressID)
{
Upvotes: 0
Views: 1243
Reputation: 56869
The SiteMapTitle attribute is for changing the title dynamically.
[SiteMapTitle("Headline")]
public ViewResult Show(int blogId) {
// Headline is a string property of blog
var blog = _repository.Find(blogId);
return View(blog);
}
[SiteMapTitle("SomeKey")]
public ViewResult Show(int blogId) {
ViewData["SomeKey"] = "This will be the title";
var blog = _repository.Find(blogId);
return View(blog);
}
Upvotes: 4
Reputation: 5156
You would have to create a custom Attribute that extends off the MvcSiteMapNode.
Within your custom attribute, you will have to come up with logic to change the Title dynamically.
Upvotes: 0