November Happy Hour will be moved to Thursday December 5th.

Strange error on Forms

Vote:
 

I have a strange error on the use of Xforms in Episerver 9..

I made a Block which renders a form, so you can implement it in every page in a contentarea. Now all good until now, sadly recently i get a 'bizarre' error:

"CS1061: System.Web.Mvc.HtmlHelper bevat geen definitie voor Translate......"

This means it doesnt contain a function or extensionmethod for 'Translate'. Now that is too bad, but the weird thing is, it refers to the file 

'/Util/Views/Shared/DisplayTemplates/XForm.ascx ' and refers to an error on line 8:

Regel 6:  <% if (actionresult !="null" && actionresult.xformid.tostring()="=" model.id.tostring() && actionresult is episerver.web.mvc.xforms.xformsuccessactionresult) regel 7: { %>
Regel 8:      <%: html.translate(" xform formposted") %>
Regel 9:  <% } else { %>
Regel 10:     <% using (html.beginxform(model, htmlattributes: new { @class="form xform" })) { %>

 

However, I work strictly with MVC and not webforms, so i'm surprised about this ascx usercontrol and when i look for this file (and even the use of html.translate)  it's nowhere to be found??? 

How can i solve this?

#140799
Oct 30, 2015 11:02
Vote:
 

Hi,

Had the same problem. Added EPiServer.Shell.Web.Mvc.Html as a global import directive in Web.config.

This needs to be in your main Web.config file and not the one in the Views folder.

It should look something like this:

<configuration>
	<system.web>
		<pages validateRequest="false" enableEventValidation="true" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" enableViewState="false">
			<namespaces>
				<add namespace="System.Web.Helpers" />
				<add namespace="System.Web.Mvc" />
				<add namespace="System.Web.Mvc.Ajax" />
				<add namespace="System.Web.Mvc.Html" />
				<add namespace="System.Web.Routing" />
				<add namespace="System.Web.WebPages" />
				<add namespace="EPiServer.Shell.Web.Mvc.Html" /> <!-- This line needs to be added -->
			</namespaces>
		</pages>
	</system.web>
</configuration>

/Jakob

#152295
Aug 23, 2016 13:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.