One of my navigation link is dynamic, for this i have created an action which returns a string when i call it with Html.RenderAction. This is working and no problems here.
How can i call the same action from inside a method that is inside a class?
So i have:
UrlHelper helper = new UrlHelper(new RequestContext(wrapper, new RouteData()));
string url = helper.action(....)
But i can’t use helper.action here as it will point to the following action but not the result returned.
public string GetItemUrl()
{
string Url = String.Empty;
if (conditionMet)
{
Url = Url.Action(ActionNames.Home, ControllerNames.Count,
new
{
Area = AreaNames.Estimates
}, HTTP);
}
else
{
Url = Url.Action(ActionNames.Index, ControllerNames.Count,
new
{
Area = AreaNames.Estimates
}, HTTP);
}
return Url;
}