Telerik Forums
UI for ASP.NET MVC Forum
0 answers
14 views

My page has a combo box. As the user selects an ID from the dropdown list, the page populates with information corresponding to the entry. It is an AJAX bound combo box. I am trying to make the combo box get auto populated with an ID from my query string on initialization. 

I've tried setting the .Value field of the combo box. This works to automatically select the correct ID and populate the rest of the page, but only when the ID exists in the data source. My AJAX call returns data based on the partial/full ID passed in, and a list of a few most recent ID's if no input ID is specified. 

I believe this will work if the ID exists in the data source prior to setting the value field of the combo box. But for that to happen, the combo box must use the ID from the url to fetch the data source, similar to what happens when a user manually types that ID into the combo box. However, I am struggling to figure out how to pass in a specific ID when the combo box is responsible for making the AJAX call. 

I would appreciate any advice or other suggestions to getting the intended behavior.

Eugenia
Top achievements
Rank 1
 asked on 27 Feb 2024
1 answer
52 views

Hello,

Is it possible to prevent the automatic selection event when navigating in a combobox using the arrows keys, just like in the multiselect example  here: https://demos.telerik.com/aspnet-mvc/multiselect/events ???

 

Iva
Telerik team
 answered on 10 Apr 2023
0 answers
34 views

We are currently trying to upgrade from 2019.3.917 to 2023.1.117

Some code that worked fine in the old version is failing in the new with error in kendo.combobox.js line 1221

Error message
Uncaught TypeError: Cannot read properties of undefined (reading 'renderButton')

Line 1221

values: kendo.cssProperties.roundedValues.concat([['full', 'full']])

the debugger is highlighting the second 'full'.

Our code is quite complex but commenting most of it out I get the same thing so a simplified version:

Our html page has this input

<input id="departments" style="width: 500px;" />

Then our javascript to create the combobox is

var $combo = $("#departments);

objKendoCB = $combo.kendoComboBox();

The second line results in the error. (the actual code sets lots of properties but I removed them one by one to end up with an empty method call).

Any ideas welcome!

 

Simon
Top achievements
Rank 1
 asked on 06 Mar 2023
0 answers
52 views
I am new to Kendo UI for ASP.NET MVC. How can I learn about all of the options for the HTML helpers?

For example, I see code like this in our codebase:

@(Html.Kendo().ComboBox()
        .Name("combobox")
        .DataTextField("ProductName")
        .DataValueField("ProductID")
        .DataSource(source => {
            source.Read(read =>
            {
                read.Action("Products_Read", "ComboBox").Data("foo");
            });
        })
    )

I'd like to understand the line that says "read.Action("Products_Read", "ComboBox").Data("foo");".

I see there is documentation out there, like:
https://demos.telerik.com/aspnet-mvc/combobox - shows the code
https://docs.telerik.com/aspnet-mvc/html-helpers/editors/combobox/overview
https://docs.telerik.com/aspnet-mvc/api/combobox
https://docs.telerik.com/aspnet-mvc/api/datasource

But even in the API documentation, I'm not seeing anything that explains what "read.Action().Data("foo")" does.

I see documentation that says, for example:
DataValueField "sets the field of the data item that provides the value content of the list items".
and
DataTextField "sets the field of the data item that provides the text content of the list items".

Those are the same definitions except for the word "value" and "text" have changed. How do I find out what that means?

Any tips for coming up to speed on this?
Rick
Top achievements
Rank 1
 asked on 13 Nov 2022
0 answers
68 views

 

In Main View

==========

columns.Bound(p => p.HuomName).Width(50).ClientTemplate("#=HuomName#").Title("H.UOM").Filterable(false).EditorTemplateName("HuomTemplate");

 

In Editor Template View

=====================

@(Html.Kendo().ComboBoxFor(m => m)
                      .Placeholder("Select H.UOM")
                      .DataValueField("uomID")
                      .DataTextField("HuomName")
                       .HtmlAttributes(new { @class = "form-control", @tabindex = "6" })
                      .DataSource(source => {
                          source.Read(read =>
                          {
                              read.Action("getGridH_UOM", "Order").Data("hUomFilter");
                          }).ServerFiltering(true);
                      })
                      .Events(e =>
                      {
                          e.Change("on_H_uom_grid_Change");
                      })
                )
Ecosoft
Top achievements
Rank 1
 asked on 03 Aug 2022
2 answers
93 views
How can i use the dropdownlist Virtualization with a guid id?
Mahdi
Top achievements
Rank 1
Iron
 answered on 27 Jun 2022
1 answer
85 views

Here's the definition of the two items that are linked by the CascadeFrom:
                      items.Add().Field(f => f.Country)
                                 .ColSpan(1)
                                 .Name("cmbCountry")
                                 .Editor(e => e.ComboBox()
                                               .AutoWidth(false)
                                               .DataTextField("name")
                                               .DataValueField("id")
                                               .BindTo(@CountryModel.Countries)
                                               .Placeholder("--- Select or Type Country"));
                      items.Add().Field(f => f.StateProvince)
                                 .ColSpan(1)
                                 .Name("cmbStatesProvinces")
                                 .Editor(e => e.ComboBox()
                                               .AutoWidth(false)
                                               .AutoBind(false)
                                               .Placeholder("--- Select State/Province ---")
                                               .DataTextField("name")
                                               .DataValueField("id")
                                               .DataSource(dS => dS.Read(read => read.Action("GetStateList", "Address").Data("filterState")).ServerFiltering(true))
                                               .CascadeFrom("cmbCountry")
                                               @*.BindTo(@StatesProvinces.StateProvince)*@
                                               );

Here's the AddressController.GetStateList:

        public JsonResult GetStateList(string? Country)
        {
            JsonResult? retval = null;
            if (!string.IsNullOrEmpty(Country))
            {   var Country_ID = CountryModel.Countries.Where(s => s.name == Country).ToList()[0].code;
                var State = StatesProvinces.StateProvince.Where(s => s.countryCode == Country_ID);
                retval = Json(State.Select(s => new { id = s.id, name = s.name }).ToList());
            }
            else
                retval = Json(StatesProvinces.StateProvince);
            
            return retval;
        }

 

This works for the first Country that is selected...  afterwards - if the Country is changed, the GetStateList is not called again to refresh the related/CascadeFrom Combobox.

Yanislav
Telerik team
 answered on 26 May 2022
2 answers
124 views

hallo,

i just wanna to disable the combobox when the chekcbox is checked and vice versa.

 

when i cheked, it disactivated, but when i check out (isChek == false) is not enable it. so it remain disabled.

 

any idea?

Alan
Top achievements
Rank 2
Iron
Iron
 answered on 21 May 2022
1 answer
115 views

The ComboBox control appears to have a configuration called HighlightFirst which supresses the automatic highlighting of the first list item as the user types.

Is there any way of implementing this same logic on the DropDownList control? By default, it appears to highlight / focus on the first option in the list when the user begins to type.

@(Html.Kendo().DropDownList()
        .Name("Sku")
        .DataValueField("Value")
        .DataTextField("Text")
        .//HighlightFirst(false)
        .Filter("contains")
        .AutoBind(false)
        .BindTo(new List<SelectListItem>()
                {
                    new SelectListItem(){ Value = "ZIP100", Text = "ZIP100 - Zip Active Stool | Stock | 400H-550H | Purple Moon	" },
                    new SelectListItem(){ Value = "ZIP101", Text = "ZIP101 - Zip Active Stool | Stock | 400H-550H | Juice Green" },
                    new SelectListItem(){ Value = "ZIP102", Text = "ZIP102 - Zip Active Stool | Stock | 400H-550H | Capri Mid Blue" },
                    new SelectListItem(){ Value = "ZIP103", Text = "ZIP103 - Zip Active Stool | Clearance | 400H-550H | Opal Light Blue" },
                    new SelectListItem(){ Value = "ZIP104", Text = "ZIP104 - Zip Active Stool | Clearance | 400H-550H | Oyster Grey" },
                    new SelectListItem(){ Value = "ZIP105", Text = "ZIP105 - Zip Active Stool | Clearance | 400H-550H | Melon Rush" },
                    new SelectListItem(){ Value = "ZIP106", Text = "ZIP106 - Zip Active Stool | Stock | 400H-550H | Charcoal" },
                    new SelectListItem(){ Value = "ZIP107", Text = "ZIP107 - Zip Active Stool | Clearance | 400H-550H | Capri Blue with NC Whale Seat Pad" },
                    new SelectListItem(){ Value = "ZIP108", Text = "ZIP108 - Zip Active Stool | Clearance | 400H-550H | Juice Green with NC Whale Seat Pad" },
                    new SelectListItem(){ Value = "ZIP109", Text = "ZIP109 - Zip Active Stool | Clearance | 400H-550H | Melon Rush with NC Whale Seat Pad" },
                    new SelectListItem(){ Value = "ZIP110", Text = "ZIP110 - Zip Active Stool | Clearance | 400H-550H | Opal Blue with NC Whale Seat Pad" },
                    new SelectListItem(){ Value = "ZIP111", Text = "ZIP111 - Zip Active Stool | Clearance | 400H-550H | Oyster Grey with NC Whale Seat Pad" },
                    new SelectListItem(){ Value = "ZIP112", Text = "ZIP112 - Zip Active Stool | Clearance | 400H-550H | Purple Moon with NC Whale Seat Pad" }
                })
    )

 

 

 

Yanislav
Telerik team
 answered on 04 Nov 2021
1 answer
134 views

I have a Telerik RadComboBox that is programmatically generated in C#. In the aspx file, I have this JavaScript function which I would like to deselect any disabled comboBox item when the "Check All" choice is selected.

 

        function OnClientCheckAllChecked(sender, args) {

            var checkedItems = sender.get_checkedItems();

            for (var i = 0; i < checkedItems.length; i++) {

                console.log(checkedItems[i].get_text());

                if (checkedItems[i].get_enabled() === false) {

                    console.log("enabled is false for " + i);
                    checkedItems[i].set_checked(false);
                }
                
                console.log("checked is " + checkedItems[i].get_checked());
            }
        }

However, it does not work as intended. The disabled item is still checked after clicking the "Check All".

Here is an image of the description:

 

enter image description here

Doncho
Telerik team
 answered on 02 Nov 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?