I'm working with ASP.Net MVC 3 with the Razor engine and version 9.104.0.20 of the SyncFusion mvc control suite.
In the documentation for this control, I am to put lines of code similar to the below in my master page:
@Html.Syncfusion().ScriptManager()
Per the Syncfusion documentation and this Stack Overflow suggestion, I have made sure to add the namespaces to my web.config file under the element.
<add namespace="Syncfusion.Mvc.Schedule"/>
The solution builds but I get the following error when I run it:
'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Syncfusion' and no extension method 'Syncfusion' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
I don't think this issue has to do with Syncfusion but instead with my inability to reference their assemblies correctly.
How do I address this?
The issue was resolved by adding the namespace reference in the element.
I had to add the following configSection information at the top of the web.config:
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
And then I had to add the SyncFusion namespaces within that defined section:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<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.Collections" />
<add namespace="Syncfusion.Mvc.Shared"/>
<add namespace="Syncfusion.Mvc.Schedule"/>
<add namespace="Syncfusion.Mvc.Tools"/>
</namespaces>
</pages>
</system.web.webPages.razor>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With