Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
Just a small message to say I'm still looking for a solution for this.
Thanks.
Hi,
I'm working with EPiServer since september now and I'm using more advanced features now but I'm stuck with something and I'd really love if someone can help me.
I have made a custom HTML Helper to use with Razor MVC to be able to use display options without having to create a custom ContentAreaRendered and everything that seems to go with it but any links I use in my view are internal ugly url (aspx stuff) and if I have any method that are supposed to transform this ugly URL into a friendly URL it does not work.
Here is part of my block model:
Here is my Helper:
public static XhtmlString RowFromArea(this HtmlHelper html, Expression> expression)
{
var returnString = "";
var area = ModelMetadata.FromLambdaExpression(expression, html.ViewData).Model as ContentArea;
if (area != null)
{
returnString += "";
foreach (ContentAreaItem item in area.FilteredItems)
{
var block = item.GetContent();
// LoadDisplayOption(item);
returnString += "" + html.PropertyFor(x => block) + " ";
}
returnString += " ";
//var urlResolver = ServiceLocator.Current.GetInstance();
//urlResolver.GetVirtualPath(new ContentReference());
}
return new XhtmlString(returnString);
}
Here is the page view where I call the actual helper:
And this is what I have in my block partial view:
You see I have an image that is a ContentReference and a Link that is can be either to an internal page or an external URL. And I get only ugly URL. I'm using the same