My company is trying to be on the cutting edge.
We built some CRUD pages using Kendo UI. But having problems with the drop down list. In .Net Core we are using razor pages, but the concepts is the same.
@(Html.Kendo().Grid<NG.Analytics.Models.Applications>()//(Model.Data)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(a => a.Id).Title("ID").Visible(false);
columns.Bound(a => a.CategoryId).EditorTemplateName("ApplicationCategory"); //Having trouble with what to put right here.
columns.Bound(a => a.CategoryId).Title("CategoryID");
columns.Bound(a => a.Title).Title("Title").Width(200);
columns.Bound(a => a.Description).Title("Description");
columns.Bound(a => a.BaseUrl).Title("Base Url").Width(120);
columns.Bound(a => a.Url).Title("Url");
columns.Bound(a => a.IconUrl).Title("Icon Url").Width(350);
columns.Bound(a => a.IsExternal).Title("Is External").Width(120);
columns.Command(command => { command.Edit(); }).Width(90);
columns.Command(command => { command.Destroy(); }).Width(100);
columns.Command(command => command.Custom("ViewDetails").Click("showDetails"));
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height: 750px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(a => a.Id); // Specify the property which is the unique identifier of the model
model.Field(a => a.Id).Editable(false); // Make the ID property not editable
//model.Field(p => p.CategoryId).DefaultValue(
//Model.ApplicationCategory as Models.ApplicationCategory);
})
.Read(read => read.Url("?handler=Data").Type(HttpVerbs.Get))
.Create(update => update.Url("?handler=CreateApplications").Type(HttpVerbs.Post))
.Destroy(update => update.Url("?handler=Applications").Type(HttpVerbs.Delete))
.Update(update => update.Url("?handler=UpdateApplications").Type(HttpVerbs.Put)))
)
<partial name="EditorTemplates/ApplicationCategoryEditor" /> //Editor is working as expected when normally use.
Here is what the partial looks like:
@(Html.Kendo().DropDownList()
.Name("CategoryName")
.DataTextField("CategoryName")
.DataValueField("Id")
.BindTo(Model.ApplicationCategory)
.HtmlAttributes(new { style = "width: 100%" })
)
I know you guys are pretty good and responsive. I just hope I can find the answer.
Thanks, Trung