I have followed the instructions shown here: http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/editor-templates
When inline editing in the Grid, the combobox renders fine, however the ID/integer of the underlying property is being filled into the textbox/input field regardless of setting .Text to string.Empty and setting .AutoBind to false. This is very annoying to have a "0" in the user's input area of the combobox. See code snippets below:
SellerEditor.cshtml
Main View w/ Grid:
ViewModel:
When inline editing in the Grid, the combobox renders fine, however the ID/integer of the underlying property is being filled into the textbox/input field regardless of setting .Text to string.Empty and setting .AutoBind to false. This is very annoying to have a "0" in the user's input area of the combobox. See code snippets below:
SellerEditor.cshtml
@model object@(Html.Kendo().ComboBoxFor(m => m) .DataTextField("SellerName") .DataValueField("SellerId") .Filter(FilterType.StartsWith) .Text(string.Empty) .Value(string.Empty) .Placeholder("") .AutoBind(false) .MinLength(1) .DataSource(source => source.Read("GetSellerSelectItems", "Now360", new { area = "Admin" }).ServerFiltering(true)) .HtmlAttributes(new { style = "width: 100%;" }) .Delay(500))Main View w/ Grid:
@(Html.Kendo().Grid<VINspinAppsWeb.Areas.Admin.Models.Now360.SellerInterestGridViewModel>() .Name("grdInterests") .Columns(columns => { columns.Bound(m => m.SellerId).Template(@<text></text>).ClientTemplate("#:SellerName#"); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(190); }) .Groupable(grouping => grouping.Enabled(false)) .Events(events => { events.DataBound("onGridInterestsDataBound"); events.Save("function(e) { kendo.ui.progress($('#grdInterests'), true); }"); events.Remove("function(e) { kendo.ui.progress($('#grdInterests'), true); }"); events.Edit("onGridInterestsEdit"); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(m => m.SubscriberSellerInterestId); model.Field(p => p.SubscriberSellerInterestId); model.Field(p => p.SubscriberId); model.Field(p => p.SubscriberSellerId); model.Field(p => p.InterestType); model.Field(p => p.MakeId); model.Field(p => p.SellerId); }) .Events(events => { events.Error("onGridError"); events.Sync("function(e) { kendo.ui.progress($('#grdInterests'), false); }"); }) .Read(read => read.Action("SellerInterestsByInterestType", "Now360", new { area = "Admin" }).Data("additionalData")) .Update(update => update.Action("UpdateInterest", "Now360", new {area = "Admin" })) .Create(create => create.Action("CreateInterest", "Now360", new { area = "Admin" })) .Destroy(destroy => destroy.Action("DeleteInterest", "Now360", new { area = "Admin" })) .Sort(sort => sort.Add(m => m.SellerName).Ascending()) .PageSize(10)) .ToolBar(toolbar => toolbar.Create().Text("New Interest")) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Filterable(filtering => filtering.Enabled(true)) .Pageable(paging => paging .Enabled(true) .Info(true) .PageSizes(false) .Refresh(true)) .Scrollable(scrolling => scrolling .Enabled(false) .Height(400) .Virtual(false)) .Sortable(sorting => sorting .Enabled(true) .AllowUnsort(false) .SortMode(GridSortMode.SingleColumn)))ViewModel:
public class SellerInterestGridViewModel{ public Guid? SubscriberSellerInterestId { get; set; } public Guid SubscriberId { get; set; } [Required] public Guid SubscriberSellerId { get; set; } [Required] [UIHint("SellerEditor")] [Display(Name = "Seller")] public int SellerId { get; set; } public string SellerName { get; set; } [Required] public short InterestType { get; set; } public byte? MakeId { get; set; }}