locked
Kendo Ui Cannot get the value field from multi column combo box RRS feed

  • Question

  • User-183185495 posted

    I am using the kendo multi column dropdown but I appear to be unable to get the value from the DatValueField I am using the value to then get the id of the person selected to be able to store that in another table.

    https://demos.telerik.com/aspnet-core/multicolumncombobox/index

    <form asp-action="LinkToCase" method="post" asp-controller="MISObjects">
    
     <div class="row">
        <div class="col-md-12">
            <div class="card card-success">
    
            <div class="card-header" style="background-color:#1e3f5a;color:white">
                <h3 class="card-title">Search and Tag</h3>
            </div>
            <div class="card-body">
    
                <div class="col-md-12">
                    <div class="input-group">
                        <select id="searchOptions" name="searchOptions" style="background-color: #1e3f5a; color: white; width: 140px; height: 45px">
                            <option selected value="1">Poi</option>
                            <option selected value="1">Vessel</option>
                        </select>
    
    
                        @(Html.Kendo().MultiColumnComboBox()
                            .Name("tagItem")
                            .DataTextField("name")
                            .DataValueField("SearchId")
                            .Filter("contains")
                            .FilterFields(new string[] { "name", "ContactTitle", "CompanyName", "Country" })
                            .Columns(columns =>
                            {
                                columns.Add().Field("name").Title("Contact Name").Width("200px");
                                columns.Add().Field("dob").Title("Date Of Brith").Width("200px");
    
                            })
                            .FooterTemplate("Total #: instance.dataSource.total() # items found")
                            .HtmlAttributes(new { style = "width:80%;" })
                            .Height(400)
                            .DataSource(source => source
                                .Custom()
                                .Transport(transport => transport
                                    .Read(read =>
                                    {
                                        read.Action("SearchQuery", "MISObjects")
                                            .Data("onAdditionalData");
                                    }))
                            )
                            )
                        <button type="submit" class="btn-primary" value="Link To Case" style=" background-color:#1e3f5a;color:white">Link To Case</button>
    
                     </div>
           </div>
       </div>
    </form>

    The kendo combox calls this function.

    [HttpPost]
    public IActionResult LinkToCase(int SearchId,string updateInfo, int tagItem, string sesearchOptionsr, IFormCollection formItems) {
        
          Int32.TryParse(TempData.Peek("CaseId").ToString(), out int resultCaseId);
          var test = formItems;
            POI newPoi = new POI();
            newPoi =  _context.Pois.SingleOrDefault(w => w.Id == SearchId);
    
            newPoi.MISObjectId = resultCaseId;
    
            _context.Pois.Add(newPoi);
    
            _toast.AddSuccessToastMessage(
                $"You have linked {newPoi.FirstName} {newPoi.LastName} to case {resultCaseId:d8}");
    
            return RedirectToAction("Edit", new { id = resultCaseId });
    
        }
        private IEnumerable<SearchViewModel> GetSearchRecords() {
            return _context.Pois.Where(w => w.isActive == true && w.isDeleted == false).Select(person =>
                 new SearchViewModel {
                     SearchId = person.Id,
                     Name = person.FirstName + "  " + person.LastName,
                     DOB = person.DOB
                 }).ToList();
    
      }
     }

    But even when I inspect SearchId it is blank even if i set it to type int I put in a support ticket as I am on trail but saw their was a kendo tag here so thought might try here as well

    For when i look at the form collection the item is not their only the name of the person selected not their id.

    Wednesday, August 19, 2020 2:46 PM

All replies

  • User475983607 posted

    The Kendo support site is a better place to find support using the Kendo framework; https://www.telerik.com/support/kendo-ui

    Wednesday, August 19, 2020 4:31 PM
  • User-183185495 posted

    True but allot of developers also use kendo ui 

    tell me Woukd their be a way of implementing a combo like theirs using pure btoostrsp and jquery   

    I woulda rather take telerik out of the equation but I need the search abilities of the combo box to be real time like theirs  if u check their basic demo function 

    quote user="mgebhard"]

    The Kendo support site is a better place to find support using the Kendo framework; https://www.telerik.com/support/kendo-ui

    Wednesday, August 19, 2020 5:29 PM
  • User-183185495 posted

    True but allot of developers also use kendo ui 

    tell me Woukd their be a way of implementing a combo like theirs using pure btoostrsp and jquery   

    I woulda rather take telerik out of the equation but I need the search abilities of the combo box to be real time like theirs  if u check their basic demo function 

    The Kendo support site is a better place to find support using the Kendo framework; https://www.telerik.com/support/kendo-ui

    Wednesday, August 19, 2020 5:32 PM