假设我的cshtml中有以下网格
@(Html.Kendo().Grid<Accessibility.Models.CompanyModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.Name);
columns.Bound(c => c.Description);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.Id))
.Create(update => update.Action("Company", "Company"))
.Read(read => read.Action("GetCompanies", "Company"))
.Update(update => update.Action("Company", "Company"))
.Destroy(update => update.Action("DestroyCompany", "Company"))
)
)
如何以编程方式创建上述网格,而不是在我的 cshtml 文件中对其进行硬编码?