MVC3下拉列表更改...加载数据
我有一个 C#.Net MVC3 Web 应用程序。我的提案模型有一个编辑视图。编辑视图上有一个包含提案列表的下拉列表。要求是,当用户更改下拉列表中的选择时,所选提案需要由提案控制器加载。我能够提交编辑视图,但不知道如何获取 DropDownList 中的值来查找选择的提案。我确信这是非常可行的。有想法吗?
I have a C#.Net MVC3 web app. There is and Edit View for my Proposal Model. On the Edit View is a drop down list with a list of Proposals. The requirement is that, when a user changes the selectin in the Drop Down list, the selected proposal needs be loaded by the Proposal Controller. I am able to get the Edit View submitted, but don't know how to grab the value in the DropDownList to find what Proposal was selected. I'm sure this is very do-able. Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将下拉列表放入表单中,然后在选择更改时提交表单。这样,选定的值将自动发送到控制器操作。或者,如果您在选择更改时手动执行一些 AJAX 请求,您可以将所选值与请求一起发送:
You could put the dropdownlist inside a form and then when the selection changes submit the form. This way the selected value will automatically be sent to the controller action. Or if you are manually doing some AJAX request when the selection changes you could send the selected value along with the request: