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

Viewdata is not reflecting in Grid and dropdwonlist

1 Answer 414 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
europeitprocurement asked on 07 Nov 2012, 07:22 AM

I'm new to the Kendo UI stuff, so please forgive me if this is an easy one; I've been trying to find some details that might tell me what I'm doing wrong, but nothing so far.

Based on radio selection I need to populate the dropdownlist values and grid. I am binding the values to dropdownlist and grid using Viewdata. Initially while loading the View there is no probelm grid and dropdownlist are loaded perfectely. but when i change the radio selection, it is not updating the grid and drodown list but data is reflected in view data.

usign this below function i am calling the controller

function Frequency(Mode) {
        var json = {
            'Frequency': Mode
            url: '@Url.Action("Index", "Pricing")',
            type: 'Post',
            data: json,
            success: function (data) {

and this is my controller

        public ActionResult Index(string Frequency)
            LoadFundDates(Frequency); // this will update the viewdata of dropdown and viewdata of grid
           return View();

and my dropdownlist in view


and my grid

        .DataSource(dataSource => dataSource
            .Model(q => q.Id(m => m.ProdId))
            .Model(q => q.Id(m => m.Ccy))
             .Model(q => q.Id(m => m.Cat))
        .Columns(columns =>
           // Columns goes here

          .Resizable(resizing => resizing.Columns(true))
          .Scrollable(scrolling => scrolling.Enabled(true).Height(600))
          .Sortable(sorting => sorting.Enabled(true))
          .Groupable(grouping => grouping.Enabled(true))
          .Filterable(filtering => filtering.Enabled(true))
          .Reorderable(reorder => reorder.Columns(true))
          .Pageable(Pageable => Pageable.Enabled(true).PreviousNext(true).Input(true).PageSizes(true).Refresh(true))
          .RowAction(row => row.HtmlAttributes.Add("data-id", row.DataItem.ProdId))
          .RowAction(row => row.HtmlAttributes.Add("data-id", row.DataItem.Ccy))
          .RowAction(row => row.HtmlAttributes.Add("data-id", row.DataItem.Cat))
                      .Selectable(s => s.Mode(GridSelectionMode.Single).Enabled(true))

Please help me to resolve this issue.

1 Answer, 1 is accepted

Sort by
Georgi Krustev
Telerik team
answered on 12 Nov 2012, 06:35 AM

After initial review of the code snippets, I noticed that the DropDownList widget does not use Ajax binding. In this case the will not be able to re-load the data, because it does not which Action method to hit. I also noticed that the code tries to re-load data ( in this case the DataSource should use Ajax binding) in the complete callback of an Ajax request. If you need to bind the widgets to the returned data then you will need to use the data() method. I will also suggest you check these help topics:

Here is a simple demo, which shows how to use read() method of the dataSource.

All the best,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question