This is a migrated thread and some comments may be shown as answers.

Blank DataTextField Events Fail

1 Answer 53 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Craig Tarr
Top achievements
Rank 2
Craig Tarr asked on 08 Jul 2011, 04:25 AM
Using 2011.1.315 I cannot get the ComboBox to update if one of the items has a blank for the Text value. I either receive a g.slice or e.replace JavaScript error.

I would like to have one entry in the ComboBox display a blank for the Text as if nothing was chosen. Right now I have to remove this blank from the list of items to get the control to function. Is there a work around for this?

here's my view:
<%= Html.Telerik().Grid<EntryList>()
            .Name("EntryList")
            .DataKeys(keys =>
            {
                keys.Add(p => p.RaceResultsID);
            })
            .ToolBar(toolbar => {
                toolbar.Insert();
               })
            .DataBinding(dataBinding =>
            {
                dataBinding.Ajax()
                        .Select("_SelectEntryListDrivers", "EntryList")
                        .Update("_UpdateDriver", "EntryList")
                        .Insert("_InsertDriver", "EntryList")
                        .Delete("_DeleteDriver", "EntryList");
            })
            .Columns(columns =>
            {
                columns.Bound(p => p.Name).Width(115);
                columns.Bound(p => p.Car).Width(40);
                columns.Bound(p => p.Manufacturer).Width(75);
                columns.Bound(p => p.Sponsor).Width(175);
                columns.Bound(p => p.Owner).Width(200);
                columns.Command(commands =>
                    {
                        commands.Edit();
                        commands.Delete();
                    }).Width(75).Title("Actions");
                columns.Bound(p => p.PersonID)
                    .ClientTemplate(Html.ActionLink("Person Edit", "Edit", new { area = "util", controller = "Person", ID = "<#= PersonID #>" }, new { target = "_blank", @class = "t-button" }).ToString()).ReadOnly(true).HtmlAttributes("class='t-button'").Title("Utility").Width(75);
                columns.Bound(p => p.RaceResultsID).Width(25).Hidden(true);
                columns.Bound(p => p.DriverEntity).Width(25).Hidden(true);
                columns.Bound(p => p.OwnerID).Width(25).Hidden(true);
                columns.Bound(p => p.NumberID).Width(25).Hidden(true);
                columns.Bound(p => p.SponsorID).Width(25).Hidden(true);
                columns.Bound(p => p.ManufacturerID).Width(25).Hidden(true);
                columns.Bound(p => p.SubSeriesName).Width(5).Hidden(true);
                columns.Bound(p => p.VehicleID).Width(5).Hidden(true);
            })
            .Sortable(sorting => sorting.OrderBy(sortOrder => sortOrder.Add(o => o.Name).Ascending()))
            .Reorderable(reorder => reorder.Columns(true))
            .ClientEvents(events => events.OnSave("onSave"))
            .ClientEvents(events => events.OnEdit("onEdit"))
        %>

The Edit Template for the column "Car". It is a list of numerical values from 0 to 99 along with a blank at the top and "none" at the bottom.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
 
<%= Html.Telerik().ComboBox()
.Name("Car")
.DataBinding(binding => binding.Ajax().Select("_SelectCarNumbers", "EntryList"))
.AutoFill(true)
.Filterable(filtering => filtering.FilterMode(AutoCompleteFilterMode.StartsWith).MinimumChars(1))
.HighlightFirstMatch(true)
.ClientEvents(events => events.OnDataBinding("onCarDataBinding"))
%>

The Controller for the Template:
[HttpPost]
        public ActionResult _SelectCarNumbers(int eventID)
        {
            var list = _util.GetOwnerNumberListByID(Int32.MinValue, Int32.MinValue, eventID);
 
            var car = list.AsQueryable();
 
            return new JsonResult { Data = new SelectList(car.ToList(), "NumberID", "NumberText") };
        }

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 08 Jul 2011, 08:21 AM
Hello Craig,

 
This is a known issue which is already addressed. The fix is available for the premium support customers. For open-source clients the fix will be available in Q2 2011 release of Telerik Extensions for ASP.NET MVC scheduled for the middle of July. 

All the best,
Georgi Krustev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
ComboBox
Asked by
Craig Tarr
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or