Want to add Html Attributes classes at run time
ASP.NET
1
Posts
1
Posters
4
Views
1
Watching
-
Hi, I have a Kendo text box @Html.Kendo().TextBoxFor(model => model.Code).Name("txtForCode").HtmlAttributes(new { autocomplete = "off", id = "idTxtForCode" }), I am able to add class static without any problem, but I want to add different classes at runtime using a JavaScript if else conditions. Just like in the below Code;
function GetLookupTableValue(e) { var noCodeFilter = containsAny($("#drpLookup").data("kendoDropDownList").text(), \['Address Type', 'Gender', 'NPI Status', 'Rendering Provider Status', 'Rendering Provider Classification'\]); if (noCodeFilter) { var url = '../Admin/GetLookupTableNoCode'; $("#divLookupTable").load(url, { LookupTableId: $("#drpLookup").data("kendoDropDownList").value() }); } else { var url = '../Admin/GetLookupTableCode'; $("#divLookupTable").load(url, { LookupTableId: $("#drpLookup").data("kendoDropDownList").value() }); /\*like here I want to add condition that if the containsAny($("#drpLookup").data("kendoDropDownList").text(), \['Provider Type', 'X type', 'some other type'\]) then txtForCode should accept only two digits else if dropdown drpLookup contains text from \['xxx', 'yyy', 'zzzz'\] then txtForCode should accept only 3 digits else if dropdown drpLookup contains text from \['aaa', 'bbb', 'ccc'\] then txtForCode should accept only 2 character capitals else if dropdown drpLookup contains text from \['ccc', 'ddd', 'eee'\] then txtForCode should accept only 5 character capitals else if dropdown drpLookup contains text from \['fff', 'ggg', 'hhh'\] then txtForCode should accept only 8 character capitals else default condition \*/ } }
Can anybody please help me with this, one way to add HtmlAttributes to the MVC Kendo Textbox is using HtmlAttributes, but it sets statically at one time but I want to change the classes run-time depending upon the dropdown selection. Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."