This is a migrated thread and some comments may be shown as answers.

I have a problem with the following implementation I want to update a dropdownlist in the save event of a grid

1 Answer 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mauricio
Top achievements
Rank 1
Mauricio asked on 19 Apr 2017, 06:37 PM

@(Html.Kendo().Grid<MasterSuiteMultiPais.Models.SURVEY>()
        .Name("grid")
        .Columns(columns =>
        {......
 .Events(events => events.Save("Updateddl"))
....
and this is my function to update


 <script type="text/javascript">
    function Updateddl() {
        $("#encuestas").data('kendoDropDownList').dataSource.read()
or
 var cat = $("#encuestas").data("kendoDropDownList");
        cat.dataSource.read();
        cat.refresh();
    }
        </script>


but this no have effect the dropdownlist is in the same page an the same controller
this is the DDL i like to update


    @(Html.Kendo().DropDownList()
                        .Name("encuestas")

                        .HtmlAttributes(new { style = "width:200px" })
                        .OptionLabel("Seleccione una encuesta...")
                        .DataTextField("surv_name")
                        .DataValueField("surv_id")
                        .Events(e => e.Change("change"))
                        .DataSource(source =>
                        {
                            source.Read(read =>
                            {
                                read.Action("GetSurvey", "Survey");
                            });
                        })
    )


Gracias!

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 21 Apr 2017, 09:00 AM
Hello Mauricio,

The provided example should successfully update the DropDownList data. Also, the refresh method is not required as the read method refreshes the widget as well.

I can suggest checking the network tab to observe if the request is sent to the server and also if the response is containing the new data.

Also, please use the dataBound event of the DropDown to check if it is rebound after the read method is called:

http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#events-dataBound

If additional assistance is needed, please provide a fully runnable example reproducing the issue and I will gladly assist.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Grid
Asked by
Mauricio
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or