开发者

transfer value of parameter from one view to other?

开发者 https://www.devze.com 2023-03-09 23:07 出处:网络
i have 2 asp.net mvc views. view1.aspx and view2.aspx. of course they are [HTTPGet] Actions for each view as 开发者_如何学Pythonwell Models View1Model.cs and View2Model.cs

i have 2 asp.net mvc views.

view1.aspx and view2.aspx.

of course they are [HTTPGet] Actions for each view as 开发者_如何学Pythonwell Models View1Model.cs and View2Model.cs

in view1.aspc I have a hyperlink <a href="\view2"></a>, by clicking on it I'am landing on view2.aspx. i want to pass some text message from view1 to view2 and display it on view2.aspx.

i want to do that with with POST method, how to do it?


You can send a POST to any action by using an HTML form with the url as view2.aspx.

Any fields within that form (eg a hidden field) are then sent as POST data and can be accessed via a parameter in the view2 action or can be bound to View2Model.

You should use the Html.BeginForm() helper for this.


I have to use just a proper HTML.ActionLink and thats it! Best answer is here

0

精彩评论

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

关注公众号