Reputation: 239
I`m using a Kendo UI grid. In here I need to pass additional data to the backend. I used this method to it. But it giving an error of ".Data() does not contain a definition for Data"
This is my cshtml code.
@(Html.Kendo().Grid<CrowdlogisticsWebMVC.Models.ContactMediumModel>()
.Name("gridAddress")
.Columns(columns =>
{
columns.Bound(p => p.PartyID).Title("").Width(30);
columns.Bound(p => p.AddressLine1).Width(150);
columns.Bound(p => p.AddressLine2).Width(150);
columns.Bound(p => p.City).Width(150);
columns.Bound(p => p.Country).Width(150);
})
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetAddresses", "Party"))
.Data("productsReadData")
)
)
<script type="text/javascript">
function productsReadData() {
return {
firstName: "John",
lastName: "Doe"
};
}
</script >
Upvotes: 0
Views: 2838
Reputation: 1688
Little mistake - Data() should be after Action() not after Read() (inside Read) like this:
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetAddresses", "Party").Data("productsReadData"))
)
Regards
Upvotes: 2