开发者

passing values between views in mvc?

开发者 https://www.devze.com 2023-01-09 08:22 出处:网络
I new on MVC. I want to send values between view\'s and don\'t know how do this开发者_如何学运维?

I new on MVC. I want to send values between view's and don't know how do this开发者_如何学运维?

also I want send selected-item in grid to another view.


Views are only used to show data passed from a controller action. So technically you need to send data to another controller action than the one that rendered the current view. A standard way of sending data to a controller action consist of sending GET/POST requests to this action and passing parameters either in the url or in the POST body. Other commonly used storages are the TempData, Session and Cache.

As to answer the second part of your question you will need to provide much more details on how is this grid rendered, how is an item selected, how are you navigating to another controller action? You could for example use a <form> with a hidden field inside that indicates the current item.

0

精彩评论

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