TruMan1
TruMan1

Reputation: 36108

Why is Orchard auto-encoding strings to the view?

In my driver, I am passing the dynamic object to the view, but it is automatically encoding all my strings which is mangling the links I am constructing in the view.

Here is what I am trying to do:

public class SomeWidgetDriver : ContentPartDriver<SomeWidgetPart>
{
    // GET
    protected override DriverResult Display(SomeWidgetPart part, string displayType, dynamic shapeHelper)
    {
        return ContentShape("Parts_SomeWidget",
            () => shapeHelper.Parts_SomeWidget(
                AppUrl: part.AppUrl,
                AppVersion: part.AppVersion,
                RenderTo: part.RenderTo,
                Test: "xxxx&"));
    }
}

When I add the below to the view:

@Model.Test

It renders like this:

xxxx&amp;

Is there a way to stop this from happening? I am trying to get it to exactly render "xxxx&".

Upvotes: 2

Views: 244

Answers (1)

santiagoIT
santiagoIT

Reputation: 9431

I don't think this has to do with Orchard at all. In Razor everything is html encoded. Did you try:

@Html.Raw(Model.Test)

?

Upvotes: 6

Related Questions