Combobox(cascading) not calling Method on Controller

5 posts, 1 answers
  1. Answer
    Agropur
    Agropur avatar
    5 posts
    Member since:
    Oct 2013

    Posted 25 Nov 2013 Link to this post

    Here is my View:
    <div class="form-group">
                @Html.LabelFor(model => model.locationCode, new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.DropDownListFor(model => model.locationCode, new SelectList(Model.Locations))
                    @Html.ValidationMessageFor(model => model.locationCode)
                </div>
            </div>
     
            <div class="form-group">
                @Html.LabelFor(model => model.loadType, new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.DropDownListFor(model => model.loadType, new SelectList(Model.LoadTypes))
                    @Html.ValidationMessageFor(model => model.loadType)
                </div>
            </div>
     
            <div class="form-group">
                @Html.LabelFor(model => model.loadDescrip, new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @(Html.Kendo().ComboBox()
                            .Name("loadDescription")
                            .Filter(FilterType.Contains)
                            .DataSource(source => {
                                source.Read(read =>
                                {
                                    read.Action("GetCascadeDocumentNumbers", "DockDoor")
                                        .Data("filterLoadDescription");
                                })
                              .ServerFiltering(true);
                            })
                            .Enable(false)
                            .AutoBind(false)
                            .CascadeFrom("loadType")
                            )
                    <script>
                        function filterLoadDescription(){
                            return {
                                locCode: $("#locationCode").val(),
                                loadType: $("#loadType").val(),
                                docNumFilter: $("#loadDescription").data("kendoComboBox").input.val()
                            };
                        }
                    </script>
                    @Html.ValidationMessageFor(model => model.loadDescrip)
                </div>
            </div>


    Here is the method in my Controller:
    public JsonResult GetCascadeDocumentNumbers(string locCode, string loadType, string docNumFilter)
           {
               var docNums = db.GetCurrentDocumentNumbers(locCode, loadType).AsQueryable();
     
               if (!string.IsNullOrWhiteSpace(docNumFilter))
               {
                   docNums = docNums.Where(x => x.Contains(docNumFilter));
               }
     
               return Json(docNums.Select(x => new {DocCode = x}), JsonRequestBehavior.AllowGet);
           }


    What am I doing wrong that this is not being called?
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 27 Nov 2013 Link to this post

    Hello,

    Thank you for the given code snippets. At first glance, the setup of the widgets looks just fine. In order to proceed with the investigation I will ask you to send us a simple repro test project. Thus I will be able to observe the issue locally and advice you further.

    Regards,
    Georgi Krustev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. ajith
    ajith avatar
    21 posts
    Member since:
    Apr 2015

    Posted 20 May 2015 in reply to Georgi Krustev Link to this post

    Hi Georgi Krustev's

    I have same issue.the problem is my id field is string not int, so i cant filter in controller. Please help me

    public JsonResult GetAssetSubGroup([DataSourceRequest] DataSourceRequest request, AssetGroupViewModel locations, string groups, string groupfilter)
            {
                try
                {
                    var assetGroup = _assetSubGroupManager.GetSubGroup();
     
                    var groupViewModel = Mapper.Map<List<SubGroupModel>, List<AssetSubGroupViewModel>>(assetGroup);
                    if (groups != null)
                    {
                        assetGroup = assetGroup.Where(p => p.group_code(groups));
                    }
                    return Json(assetGroup.Select(c => new { ID = c.group_code, Name = c.name })
                        .OrderBy(o => o.ID)
                        .ToList(), JsonRequestBehavior.AllowGet);
     
                }
                catch (Exception ex)
                {
                    throw;
                }
            }

  5. ajith
    ajith avatar
    21 posts
    Member since:
    Apr 2015

    Posted 20 May 2015 in reply to Agropur Link to this post

    hi Agropurs,

        I have same issue. is your issue is resolved?. if yes help me too. Thank you in advance.

  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 22 May 2015 Link to this post

    Hello ajith,

    The shared code is not sufficient to determine why the cascading functionality does not work on your end. Could you send us a repro demo that demonstrates the issue?

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready