如何从 EF 中的 ViewBag 填充 jquery ui 可选列表?
我正在尝试将 Jquery Ui 中的序列化可选 添加到 MVC 中的视图中。具体来说,我希望主管能够从他/她的下属列表中选择单个或多个员工。该员工列表将构建在控制器中并分配给 ViewBag。我希望可以选择填充此 ViewBag 中的员工。
解决这个问题的最佳方法是什么?我也不同意使用 ViewBag 来完成此任务。
I am trying to add a serialized selectable from Jquery Ui to a view in MVC. Specifically, I would like a supervisor to be able to select individual or multiple employees from a list of his/her subordinates. This list of employees would be built in the controller and assigned to a ViewBag. I would like the selectable to be populated with employees from this ViewBag.
What is the best way of going about this? I'm also not married to the idea of using a ViewBag to accomplish this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
viewbag(或模型)是将数据从控制器传递到视图的机制。视图将渲染 html。其中可以有一个有序列表。那么你就会有一个带有适当 jquery 代码的脚本标签。所以它看起来像这个
控制器
视图
jquery
the viewbag, or model, is the mechanism to pass data from the controller to the view. the view will render the html. in this can an ordered list. then you would have a script tag with the appropriate jquery code. so it will look something like this
controller
view
jquery