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

Foreignkey dropdown donot reload even after the ViewData is updated and DataSource.Read is called

2 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkatesh
Top achievements
Rank 1
Venkatesh asked on 23 Jan 2013, 05:33 PM
We are evaluating the use of Kendo UI for one of our internal web site development and we have come across an issue related Grid Foreign Key Column.

As shown in the picture attached, we need to populate the Billing Roles Dropdown in the Grid based on the Engagement selected. We are seeing multiple issues to do this. We have tried to use following javascript code to force the Dropdown to reload, the problem with the following approach is JQuery cannot find the DropDown element unless the Grid has New Row or existing rows. But even after having a Row populated in the grid, the dropdown was not getting reloaded with new options. I have placed the similar dropdown outside of the Grid, that grid is getting filtered without any issues.
var dropDown = $("#BillingRoleId").data("kendoDropDownList")
    dropDown.dataSource.read();

We have even tried to reload the grid with the following javascript, but the dropdown list is not refreshed.
var grid = $("#BillingRoles").data("kendoGrid");
    grid.dataSource.read();

The Dropdown list is getting stuck with the initially bounded options while loading the page. It does not seem pick up any modifications done on the ViewData. I am attaching the Model, View and Controller files with the request. Can you please review the same and help us unblock with this issue.

Project Details,
CreateNewRequest is the controller and AddBillingRoleRequestViewModel is the parent which will have collection of AddBillingRoleViewModel. We have created two partial views under CreateNewRequest folder. AddBillingRole.cshtml generates the Grid with the dropdowns. Index.cshtml renders _RequestFormSelect.cshtml and AddBillingRole.cshtml.

2 Answers, 1 is accepted

Sort by
0
Venkatesh
Top achievements
Rank 1
answered on 23 Jan 2013, 05:39 PM
If you could provide a sample with the scenario we are trying to address would be of great help.
0
Venkatesh
Top achievements
Rank 1
answered on 24 Jan 2013, 09:17 AM
We found that the issue is with the way we have designed the workflow. We should be using conditional rendering of partial views instead of trying to refresh the dropdowns in the Grid. Please disregard this issue.
Tags
Grid
Asked by
Venkatesh
Top achievements
Rank 1
Answers by
Venkatesh
Top achievements
Rank 1
Share this question
or