passing values between views in mvc?
I new on MVC. I want to send values between view's
and don't know how do this开发者_如何学运维?
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.
精彩评论