Grid binding error - CS1061: 'Syncfusion.JavaScript.GridPropertiesBuilder<object>' does not contain a definition for 'DataSource'

I created new MVC 5 project folowing steps here: http://help.syncfusion.com/aspnetmvc/getting-started#mvc-5-application (except that a choose all the available syncfusion components)
At first I tried "Date Picker demo" and it wos working OK.

Next I tried to follow this guide: http://help.syncfusion.com/aspnetmvc/grid/getting-started#create-your-first-grid-in-mvc
Result was OK - I was able to run it and see grid with header without any records in it. Perfect.

Next step was to add some data binding: http://help.syncfusion.com/aspnetmvc/grid/getting-started#data-binding
I pasted the code, but unfortunately, I got this error: CS1061: 'Syncfusion.JavaScript.GridPropertiesBuilder<object>' does not contain a definition for 'DataSource' and no extension method 'DataSource' accepting a first argument of type 'Syncfusion.JavaScript.GridPropertiesBuilder<object>' could be found (are you missing a using directive or an assembly reference?)

I know this is newbie problem, but Im new to this :)
I tried to find solution on your forum and found this thread: http://www.syncfusion.com/forums/118667/Cannot-DataBind-a-Grid
So I checked .JS references, and it seems I have them all in place:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
   @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/modernizr")
   <link rel='nofollow' href="@Url.Content("~/Content/ej/web/Default-theme/ej.widgets.all.min.css")" rel="stylesheet"/>
   <script src="@Url.Content("~/Scripts/jquery-2.1.4.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jsrender.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.easing.1.3.min.js")"></script>   
    <script src="@Url.Content("~/Scripts/ej/ej.web.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.unobtrusive.min.js")"></script>
</head> 


My complete index.cshtml is as follows:

@{
    ViewBag.Title = "Home Page";
}

<br />

@(Html.EJ().Grid<object>("FlatGrid")
        
        .DataSource(d => d.URL("http://mvc.syncfusion.com/UGService/api/Orders").CrossDomain(true).Offline(true)).Columns(col =>

    {

        col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add();

        col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();

        col.Field("ShipName").HeaderText("Ship Name").Width(100).Add();

        col.Field("ShipCity").HeaderText("Ship City").Width(100).Add();

        col.Field("Freight").Format("{0:c3}").HeaderText("Freight").Width(80).TextAlign(TextAlign.Right).Add();

    })

)

Attachment: Ticking_3f7c33c3.7z

3 Replies

TF Tom Frajer May 4, 2016 01:56 PM UTC

Okay, I found solution to my problem.

@(Html.EJ().Grid<object>("FlatGrid")
.DataSource(d => d.URL("http://mvc.syncfusion.com/UGService/api/Orders").CrossDomain(true).Offline(true)).Columns(col =>

You should check this tutorial as I just copy-pasted it and there is upper case S on DataSource that was causing the error.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team May 5, 2016 06:16 AM UTC

Hi Tom 

Thanks for contacting Syncfusion Support. We are sorry for the inconvenience. 

We will modify Datasource API of Grid and refresh the following online Getting-started document shortly. 


Regards, 
Seeni Sakthi Kumar S. 



SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team May 6, 2016 12:37 PM UTC

Hi Tom, 

We have modified the Datasource API of Grid and refreshed the following online Getting-started document. 

 
Regards, 
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon