Skip to main content

Kendo dropdown list tamplate to disable selected items inside


Disabled few selected items inside dropdown list based on model data
Model return object list and
By using template do the disable and on click false for selected items
@(Html.Kendo().DropDownList()
    .Name("DateRange")
    .DataTextField("RangeNameDefault")
    .DataValueField("ID")
    .BindTo(Model.dashboardDateRangeList)
    .HtmlAttributes(new { style = "width: 100%" })
    .Events(e => e.Change("DateRangeChange"))
    .Template(
     "<span class=\"#: !data.IsDataReady ? 'k-state-disabled': ''#\" onclick=\"#: !data.IsDataReady ? 'return false': ''#\"> #: data.RangeNameDefault #</span>"))

Comments

Popular posts from this blog

how to check powershell version

 Run powershell as administrator      Run below command $PSVersionTable.PSVersion  

Calculate possible ceiling max values based on denominator

                    double higherMaxValue = 100; double maxValue = 1235; int cntDigit = maxValue >= 10 ? maxValue.ToString().Length : 1; int denominator = (int)Math.Pow(10, cntDigit - 1); higherMaxValue = maxValue + denominator - (maxValue % denominator); Console.WriteLine("maxValue:"+maxValue+" higherMaxValue:"+higherMaxValue);                       // maxValue:1235 higherMaxValue:2000