<div id="divGrid">
@(Html.Kendo().Grid<dynamic>()
.Name("gridItem")
.Columns(columns =>
{
if (Model != null)
{
foreach (System.Data.DataColumn column in Model.Columns)
{
columns.Bound(column.ColumnName);
}
}
})
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.Scrollable()
.HtmlAttributes(new { style = "width: 1800px; height: 600px;" })
.Events(e => e.DataBound("ModuleItem.OnColumnWidth"))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
if (Model != null)
{
foreach (System.Data.DataColumn column in Model.Columns)
{
var field = model.Field(column.ColumnName, column.DataType);
field.Editable(false);
}
}
})
.Read(read => read.Action("Read", "Item"))
)
)
</div>
@section Scripts {
<script src="~/js/item.js" asp-append-version="true"></script>
}var ModuleItem = (function () {
var init = function () {
};
var setColumnWidth = function () {
debugger;
var options = $("#gridItem").data("kendoGrid").getOptions();
for (i = 0; i < options.columns.length; i++) {
options.columns[i].width = "100px";
}
$("#gridItem").data("kendoGrid").setOptions(options);
};
return {
Init: init,
OnColumnWidth: setColumnWidth
};
})();
$(document).ready(function () {
ModuleItem.Init();
});The kendo grid is bound dynamically from a datatable since the columns can be dynamic.
How to set the with of the columns. I am using the code as described but getting this error for each row. Also if I need to modify column attributes where should it be handled.
Uncaught TypeError: Cannot read properties of null (reading 'sort')I'm using DropDownList in grid as EditorTemplate. If no value is selected I get a message that says "The Id field is required". How to change the message or remove it completely?
Hi All,
We have a table for managing a business process that needs to display an item from the inventory tables. Therefore we need the column showing what Item a record will use to be a ForeignKey column. We have had various problems getting this to work, and our best solution so far is still not functional. The DropDownList just closes as soon as you click into it. It is bound with server filtering.
The column definition:
columns.ForeignKey(p => p.ItemMasterId, ds => ds.Read(r => r.Action("ItemMasters", "MasterMix")), "ItemId", "ItemName", true)
.Title("Item Name").Width(500).EditorTemplateName("ItemMasterDropDownEditor");
The editor template:
@model object
@(Html.Kendo().DropDownListFor(model => model)
.DataSource(source =>
{
source.Read("ItemMasters", "MasterMix").ServerFiltering();
})
.Filter(FilterType.Contains)
.DataValueField("ItemId")
.DataTextField("ItemName")
)
The server-side call:
public ActionResult ItemMasters(string text)
The list is working correctly showing all we need. We just can't get the dropdown to stay open and have the cursor in the filter search text box.
Thanks in advance... Bob Graham

The left column should occupy vertically the same as the right column.
Hi,
Telerik.UI.for.AspNet.Core v2023.2.82 is still referencing multiple deprecated MS packages, all of the dependencies that start with 'Microsoft.AspNetCore' are version 2.1.0 and are showing as Deprecated by Microsoft.

I need to find refresh values of DropDownList programmatically. That's what I tried:
let nameDropDownList = $('#Configs').getKendoDropDownList();
console.log(nameDropDownList);
console.log(nameDropDownList.datasource);
nameDropDownList.datasource.read();
nameDropDownList.value(currentConfigName);
When read is called, I get:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'read')Log shows me, that datasource is undefined.
DropDownList definition: @(Html.Kendo().DropDownList()
.Name("Configs")
.DataTextField("Name")
.DataValueField("Name")
.Filter(FilterType.StartsWith)
.DataSource(s =>
{
s.Read(r => r.Action("Read", "FilteringTable"));
}))