This is a migrated thread and some comments may be shown as answers.

Stand-alone DataSource initialize with local data

2 Answers 138 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nikita
Top achievements
Rank 1
Iron
Nikita asked on 22 May 2020, 08:45 PM

There is a way to declare a stand-alone data source in Kendo and initialize it with an array. https://docs.telerik.com/kendo-ui/framework/datasource/basic-usage#creating-local-data-sources

Is there an equivalent MVC helper for this?

 

2 Answers, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 26 May 2020, 12:28 PM

Hello Nikita,

You can initialize a stand-alone DataSource instance:

@(Html.Kendo().DataSource<OrderViewModel>()
        .Name("myDataSource")
        .Ajax(d=>d.Read(r => r.Action("ReadOrders", "Home")))
    )

Setting the Name() configuration allows you to access the DataSource instance on the client. You can find more details here.

When using the Telerik UI for ASP.NET MVC server-side wrappers creating a dataSource from local data is not supported. Creating widgets using the Telerik UI for ASP.NET MVC server-side wrappers allows you to render the HTML and JavaScript that are needed to initialize a Kendo UI widgets and whose options propagate to the client-side. Note that this happens on the server, thus local, client-side data is not available. If you need to create a dataSource instance from local data you will need to handle this on the client and use Kendo UI for jQuery. In this scenario define the dataSource as demonstrated in the article you cited above. 

The DataSource HtmlHelper supports several built-in types of data binding and you can read more on them here:

https://docs.telerik.com/aspnet-mvc/html-helpers/datasource/types

Regards,
Aleksandar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Nikita
Top achievements
Rank 1
Iron
answered on 26 May 2020, 03:24 PM
Thank you! That answers it.
Tags
General Discussions
Asked by
Nikita
Top achievements
Rank 1
Iron
Answers by
Aleksandar
Telerik team
Nikita
Top achievements
Rank 1
Iron
Share this question
or