I want to disable a combobox. I have my example below. The only way I see to do it is through a script, also shown. If this script isn't the best way I'm open to suggestions.
However, for my script to work I need to know the id of the control. My approach was picked up off other posts but doesn't seem to do anything.
ComboBox:
@(Html.Kendo().ComboBoxFor(x => x.Item.CountryCode) .Placeholder("Select Country...") .DataTextField("Name") .DataValueField("Code") .Filter(FilterType.Contains) .DataSource(source => { source.Read(read => { read.Action("GetCountries", "Persons"); }); }) .HtmlAttributes(new { style = "width: 100%", @id = "countryCodes" }))
What I get when I press F12 and get the source in the browser:
<span class="k-widget k-combobox k-combobox-clearable" style="width: 100%;"><span tabindex="-1" unselectable="on" class="k-dropdown-wrap k-state-default"><input name="Item.CountryCode_input" class="k-input" type="text" autocomplete="off" title="" role="combobox" aria-expanded="false" placeholder="Select Country..." style="" tabindex="0" aria-disabled="false" aria-readonly="false" aria-autocomplete="list" aria-owns="countryCodes_listbox" aria-busy="false" aria-activedescendant="79fa18f7-e213-4d76-be7a-e4eb980f85f2"><span unselectable="on" class="k-icon k-clear-value k-i-close k-hidden" title="clear" role="button" tabindex="-1"></span><span unselectable="on" class="k-select" aria-label="select" role="button" tabindex="-1" aria-controls="countryCodes_listbox"><span class="k-icon k-i-arrow-60-down"></span></span></span><input id="countryCodes" name="Item.CountryCode" style="width: 100%; display: none;" type="text" value="" data-role="combobox" aria-disabled="false" aria-readonly="false"></span>
Form definition & Script:
<form asp-action="Edit" asp-all-route-data="routeKeys" onsubmit="onSubmit()">...<script> function onSubmit(e) { $("#name").attr("disabled", true); $("#Item_CountryCode").attr("disabled", true);...
