We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Existing Solution

I would like to know how to use the Syncfusion ASP.NET MVC controls in an existing solution. In order to use the Grid control I referenced the Syncfusion.Grid.Mvc.dll in my solution and I used code from Grid -> Getting Started section but i had the following error message.

'System.Web.Mvc.HtmlHelper<dynamic>' does not contain a definition for 'Syncfusion' and no extension method 'Syncfusion' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?)

My C# code is the code below:

<div style="width:100%" class="sample-panel-margin">
    @(Html.Syncfusion().Grid<MvcApplication4.Models.Student>("Simple_Grid", "GridModel", column =>
        {
            column.Add(p => p.StudentID).HeaderText("Student ID").Width(100);
            column.Add(p => p.Name).HeaderText("Name").Width(20);
            column.Add(p => p.Surname).HeaderText("Surname").Width(20);
            column.Add(P => P.DateOfBirth).HeaderText("Date of birth").Format("{OrderDate:MM/dd/yyy}");
            column.Add(p => p.Maried).HeaderText("Maried").Format("{OrderDate:MM/dd/yyy}");
            column.Add(p => p.NumberOfChildren).HeaderText("Number of children").Format("{OrderDate:MM/dd/yyy}");
        }))
</div>

Thanks in advance.

4 Replies

AR Ajith R Syncfusion Team September 3, 2013 06:42 AM UTC

Hi Manolis,

 

Thanks for using Syncfusion products.

 

Query : Reference based error in Grid MVC

 

We suspect that you have missed some Grid dependent references in your existing solution. We suggest you to add the Grid dependent references in your solution to resolve the issue. Please refer our online documentation link below to know the details about the references in the Grid.

 

http://help.syncfusion.com/ug/asp.net%20mvc/grid/default.htm#!documents/howdoiaddessentialgr1.htm

 

http://help.syncfusion.com/ug/asp.net%20mvc/grid/default.htm#!documents/213dll.htm

 

Please refer the below link to download the sample.

 

Sample.zip

 

Please let us know if you have any concerns.

 

Regards,

 

Ajith R

 



MA Manolis September 3, 2013 11:15 AM UTC

For some reason it does not work. First of all it does not recognize the Syncfusion object. For example in the following lines that I have to define in the header part of the page, the Syncfusion is not recognized:

@{Html.Syncfusion().StyleManager() 
        .Register(stylesheets =>
            {
             stylesheets.Add(ComponentType.Grid);
            }).Render();}

and the error message is the following:

System.Web.Mvc.HtmlHelper<dynamic>' does not contain a definition for 'Syncfusion' and no extension method 'Syncfusion' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?)

In the code above, the ComponentType is not recognized as well.

I also tried to run the sample and the following error appeared on the screen. 

Assembly 'Syncfusion.Grid.Mvc, Version=11.2440.0.25, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89' uses 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Is there something else that I have to do in order to make it work?

I use Visual Studio Professional 2012 and .NET Framework v4.5



MA Manolis September 4, 2013 05:43 AM UTC

It is ok. I just found a way to automatically convert an existing project to an Syncfusion MVC project. I right clicked on the prject name and selected the command Convert to Syncfusion MVC Application from the Syncfusion VS Extensions submenu.


AR Ajith R Syncfusion Team September 5, 2013 12:25 PM UTC

Hi Manolis,

 

Thanks for your update.

 

Could you please let us know whether your reported issue has been resolved or if not please provide more information regarding the issue so that we could sort out the issue and provide you with solution. The information provided would be of great help in resolving the issue.

 

Please let us know if you need any further assistance.

 

Regards,

 

Ajith R


Loader.
Live Chat Icon For mobile
Up arrow icon