开发者

Update partial view after rebinding Telerik grid

开发者 https://www.devze.com 2023-03-09 23:46 出处:网络
I have a MVC3 view that has a Telerik grid with Person information. This grid will be \"rebinded\" when adding/changing/deleting a person via ajax.

I have a MVC3 view that has a Telerik grid with Person information. This grid will be "rebinded" when adding/changing/deleting a person via ajax. On the same page is a user control with a partial view that contains 3 dropdown lists. How can I refresh the partial view and thereby the dropdownlists as a result from the rebind of the Telerik grid?


Many thanks, it looks to be going in the direction I want, but not the whole way. I tried to incorporate your tips, but didn't manage to get it work. Here are a little more details:This model contains, amongst others, a list of employees in a company and 2 lists of persons created on the bases of some condition based on the employees from the company.

Like this:

employee list = Person1, Person2, Person 3

Projectmanagers = Person1, Person2 Developers = Person1, Person3

The list with employees are shown in a Telerikgrid that can be used to Add, Update or Delete employees.

The sublists are displayed are displayed by meanse of a partial view and has 2 dropdownlists.

When I make a change to the one of the employees (vi开发者_如何学Pythona the Telerik grid) I want this change reflected in the dropdownlists. For instance, when I add a new employee to the company, say Person4. I want this new employee to be available in the list with projectmanagers (when it fullfills the condion to be a project manager) or in the developer list when it is a developer.

The Telerikgrid will be updated via Ajax.Now I also want to update the dropdownlists with Ajax after the Telerikgrid has been rebound (.ClientEvents(events => events.OnDataBound("Grid_onDataBound"))).

How to solve this??


You need to get the updated HTML for your partial view after the grid is bound. You can use the OnDataBound event of the grid and $.ajax to request an action method which will render the partial view. Here is a blog post showing how to do that.

0

精彩评论

暂无评论...
验证码 换一张
取 消