重新绑定 Telerik 网格后更新部分视图
我有一个 MVC3 视图,其中包含包含人员信息的 Telerik 网格。当通过ajax添加/更改/删除人员时,该网格将被“重新绑定”。 同一页面上有一个用户控件,其部分视图包含 3 个下拉列表。如何刷新部分视图以及重新绑定 Telerik 网格后的下拉列表?
非常感谢,它看起来正在朝着我想要的方向发展,但不是完全如此。我尝试采纳你的建议,但没能成功。这里有更多细节:该模型包含公司中的员工列表和根据公司员工的某些条件创建的 2 个人员列表。
像这样:
员工列表=人员1,人员2,人员3
项目经理=人员1,人员2 开发人员 = Person1、Person3
包含员工的列表显示在 Telerikgrid 中,可用于添加、更新或删除员工。
显示的子列表通过部分视图显示,并有 2 个下拉列表。
当我对一名员工进行更改(通过 Telerik 网格)时,我希望此更改反映在下拉列表中。例如,当我添加一个新员工时 对于公司,说 Person4。我希望这名新员工能够出现在项目经理的列表中(当它满足成为项目经理的条件时)或出现在 是开发者时的开发者列表。
Telerikgrid 将通过 Ajax 更新。现在我还想在 Telerikgrid 反弹后使用 Ajax 更新下拉列表(.ClientEvents(events => events.OnDataBound("Grid_onDataBound")))。
怎么解决这个问题??
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 (via 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??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
网格绑定后,您需要获取部分视图的更新 HTML。您可以使用 OnDataBound 事件和 $.ajax 请求将呈现部分视图的操作方法。 这里是一篇博客文章,展示了如何执行此操作。
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.