如何从部分视图取回数据
我在一个表单视图内有一个部分视图(使用 MVC2 .net)。部分视图有一个文本框并且是强类型的。
问题是,当我回发时,我无法从部分视图中获取文本框数据,由于某种原因,我可以获取控制器上的所有视图数据输入,但部分视图不会返回文本框数据。
有人可以帮我吗?
I have a partial view (using MVC2 .net) inside a view which is a form. the partial view has a textbox and is strongly typed.
The problem is I can't get the textbox data from the partial view when I post back, for some reason I can get all the view data inputs on the controller but the partial view, doesn't return the textbox data.
Can anybody help me please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非您发布更多细节和一些代码,否则很难提供帮助。如果没有的话,这里有一些可能有帮助的建议。
您将需要一个提交按钮或一些 JavaScript 来将表单发布到部分中。如果您提交的页面上有另一个表单,则它将不包含来自其他表单的数据和页面上的输入。
另外,表单必须回发到控制器操作,部分只是在另一个视图中渲染视图的帮助器。
It is hard to help unless you post a bit more detail and some code. Without that here are some suggestions that might help.
You will need a submit button or some JavaScript to post the form inside the partial. If you have another form on the page which you are submitting, it will not include data from other forms and inputs on the page.
Also to form has to post back to a controller action, a partial just a helper to render a view inside another view.