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

Cascading dropdownlist on layout page

1 Answer 123 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Shital
Top achievements
Rank 1
Shital asked on 19 Feb 2016, 09:50 PM

I have two dropdown at layout screen which can be use by more than one view.

My first view contain layout screen(with cascading dropdown) and scheduler control.

1.On Page load ,both cascading dropdown should populate with default value with scheduler calendar.

2.Scheduler control should load based on cascading dropdown selection change.

Issue#1 : My second dropdown is not loading and it is disable.

issue#2 : Scheduler control loading before layout dropdowns call. 

Layout view :

@(Html.Kendo().DropDownList()
                      .Name("Facility")
              .HtmlAttributes(new { style = "width:100%" })
                      .DataTextField("FacilityName")
                      .DataValueField("FacilityId")
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      read.Action("GetFacilityList", "Facility");
                  });
              })
)

cascading dropdown:

@(Html.Kendo().DropDownList()
              .Name("Location")
              .HtmlAttributes(new { style = "width:100%" })
                      .DataTextField("LocationName")
                      .DataValueField("LocationId")
                      .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      read.Action("GetFacilityLocationsList", "Facility")
                          .Data("filterLocations")
                       .Type(HttpVerbs.Post);
                  })
                  .ServerFiltering(false);
              })
              .Enable(true)
              .AutoBind(true)
                      .CascadeFrom("Facility")
                                )
                                <script>
                                    function filterLocations() {
                                        alert("filter");
                                        return {
                                            facilityId: $("#Facility").val()
                                        };
                                    }

 

Sceduler partial view:
 @(Html.Kendo().Scheduler<ORSA.ViewModel.ScheduleViewModel>()
          .Name("scheduler")
          .Date(DateTime.Today)
                  .StartTime(6, 00, 00)
                  .EndTime(23, 00, 00)
          .Height(800)
          .Views(views =>
          {
              views.WeekView(weekView => weekView.Selected(true));

          })
                  .Editable(editable =>
                  {
                      editable.TemplateName("CreateCase");
                  })
          .Timezone("Etc/UTC")
          .Group(group => group.Resources("Rooms"))
          .Resources(resource =>
          {
              resource.Add(m => m.Room.RoomId)
                  .Title("Rooms")
                  .Name("Rooms")
                  .DataTextField("RoomCode")
                  .DataValueField("RoomId")
                  .BindTo(Model.RoomList);
          })
              .DataSource(d => d.Read("DisplayBlocks", "Schedule"))

    )

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 24 Feb 2016, 08:42 AM
Hello Shital,

Straight up to your questions:

#1: If the second widget is disabled, then it is not cascading from the first one or the parent does not have any value. Note that parent widget should on the page when child is added, otherwise the cascading functionality will not work.

Examine our online demo for more details. You can use it as a reference implementation.

#2: You can prevent initial loading of the Scheduler setting its AutoBind option to false: Once the dropdownlists are bound (you can use dataBound event to determine that) you can filter the scheduler. You need to be familiar with DataSource API to be able to do that:
Regards,
Georgi Krustev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DropDownList
Asked by
Shital
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or