Skip to main content
ID

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataGridBuilder<T>.DataSource(JS) Method

Binds the UI component to data. Mirrors the client-side dataSource option.

Namespace: DevExtreme.AspNet.Mvc.Builders

Assembly: DevExtreme.AspNet.Core.dll

#Declaration

C#
public DataGridBuilder<T> DataSource(
    JS js
)

#Parameters

Name Type Description
js JS

A JavaScript expression that represents a DevExtreme data source.

#Returns

Type Description
DataGridBuilder<T>

A reference to this instance after the method is called.

#Remarks

This method allows you to bind a DataGrid control to a DevExtreme data source initialized in JavaScript code.

Use the new JS() expression to specify the data source:

<script>
    var myDataSource = new DevExpress.data.ArrayStore(...);
</script>

@(Html.DevExtreme().DataGrid()
    .DataSource(new JS("myDataSource"))
)

Note

This is low-level API. Use it only if other method overloads do not suit your requirements.

See Also