Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while disabling kendo grid popup editor cascading dropdownlist using ajax its disable before assign value and then getting enabled while value assigned to it


Iam filtering Location Based on Country
And section Based on Country and Location

and need to disable three dropdownlists disable based on conditions.
Its working.But section dropdownlist is assigning values after disabling, and it gets enable again.

What I have tried:

Here my Kendo Grid
<pre>@(Html.Kendo().Grid<AttendanceCentralization.Models.DepartmentViewModel>
                    ()
                    .Name("Grid")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.Dept_Id).Hidden();
                        columns.Bound(o => o.Dept_Name).Title("Name");
                        columns.Bound(o => o.Country_Name).Title("Country");
                        columns.Bound(o => o.Loc_Name).Title("Location");
                        columns.Bound(o => o.Sec_Name).Title("Section");


                        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
                    })
                    .ToolBar(toolbar => toolbar.Create())
                    .Pageable()
                    .Sortable()
                     .Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("DepartmentTemplateView"))
                    .Filterable()
                    .Groupable()
                    .Events(e =>
                    e.Edit("onEdit")

                    )
                    .HtmlAttributes(new { style = "height:500px;" })
                    .DataSource(dataSource => dataSource
                   .Ajax()
                    .PageSize(6)
                   .Model(model => model.Id(p => p.Dept_Id))

                      
                      .Read(read => read.Action("Read", "Home", new { PageTag = "Department" }))
                            .Update(update => update.Action("CreateDepartment", "Home", new { Mode = "Edit" }))
                             .Create(create => create.Action("CreateDepartment", "Home", new { Mode = "Add" }))
                             .Destroy(destroy => destroy.Action("CreateDepartment", "Home", new { Mode = "Delete" }))
                        )


)


 function onEdit(e) {
        debugger;
 var ddlc = $("#Dept_CountryId").data("kendoDropDownList");
var ddlLoc = $("#Dept_LocId").data("kendoDropDownList");
        var ddls = $("#Dept_SecId").data("kendoDropDownList");
       
        
        
            var DeptId = $("#Dept_Id").val();
            debugger;
            $.ajax({

                type: "POST",
                url: '@Url.Action("GetDeptReference", "Home")',
                data: { "DeptId": DeptId },
                dataType: 'json',
                success: function (data) {
                     debugger;
                    if (data.success == true) {
                       
                        ddls.enable(true);

                        ddlc.enable(true);
                        ddlLoc.enable(true);
                    }
                    else {
                       
                        ddls.enable(false);

                        ddlc.enable(false);
                        ddlLoc.enable(false);
                        
                    }
                }


            });

        

    }


Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900