Multiple Textstring Error: 'string' does not contain a definition for 'InnerText'
I have used the Multiple Textstring datatype on other sites and not had any issues with it. However, on one site I am getting the following error:
Error Loading Razor Script (file: ) 'string' does not contain a definition for 'InnerText' at CallSite.Target(Closure , CallSite , Object ) at ASP._Page_App_Data_TEMP_Razor_inline_5c6810aa18a650d7a98ff0f412f12d66_cshtml.Execute() in d:\Websites\C149392\ccmgatx.org\wwwroot\App_Data\TEMP\Razor\inline-5c6810aa18a650d7a98ff0f412f12d66.cshtml:line 3 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
This site is Umbraco 4.7.2 and i am using uComponents 4.1.0.
The code that generated this error is:
<ul> @foreach (var x in Model.varieties) { <li>@x.InnerText</li> } </ul>
I've uninstalled and re-installed uComponents and still have this issue. With the same code on other 4.7.2 sites this works fine.
Is there something else in the uComponent or Umbraco code or core that could be causing this?
Quickest solution is to remove the ".InnerText" and just use "@x".
Longer answer, with fallback solution: The package installer does have an option to disable the Razor Model Binding, which was a new feature (in v4.0). The Razor engine is able to cast the data-type values into strongly-type models, for easier access/use. The side-effect of this is that existing Razor scripts would most likely break.
To disable that functionality, add this option to your Web.config's AppSettings:
Thank you for the quick answer Lee. After percolating on this a bit I decided to back up my /bin folder up on the server and recopy the .dlls from my local instance of this same project up to the server. This seems to have done the trick and my script is working now. Not sure which .dll was the culprit. If I run into this again maybe I'll try and figure that out.
Multiple Textstring Error: 'string' does not contain a definition for 'InnerText'
I have used the Multiple Textstring datatype on other sites and not had any issues with it. However, on one site I am getting the following error:
This site is Umbraco 4.7.2 and i am using uComponents 4.1.0.
The code that generated this error is:
I've uninstalled and re-installed uComponents and still have this issue. With the same code on other 4.7.2 sites this works fine.
Is there something else in the uComponent or Umbraco code or core that could be causing this?
Hi Janet,
Quickest solution is to remove the ".InnerText" and just use "@x".
Longer answer, with fallback solution: The package installer does have an option to disable the Razor Model Binding, which was a new feature (in v4.0). The Razor engine is able to cast the data-type values into strongly-type models, for easier access/use. The side-effect of this is that existing Razor scripts would most likely break.
To disable that functionality, add this option to your Web.config's AppSettings:
Cheers, Lee.
Thank you for the quick answer Lee. After percolating on this a bit I decided to back up my /bin folder up on the server and recopy the .dlls from my local instance of this same project up to the server. This seems to have done the trick and my script is working now. Not sure which .dll was the culprit. If I run into this again maybe I'll try and figure that out.
is working on a reply...