开发者

Persisting the List and Getting it back in Controllers action

I have an action whe开发者_StackOverflowre I get the list from the database and pass it to the view. Now, I want that when I fire another action I can somehow get hold of that list (List). How can I do that since ViewData and the TempData is erased on each request.


TempData does get erased on each request, but there is nothing stopping you from setting it again so that it will be there for the next request as well.

That said, in this case your problem is really about avoiding repeated queries, so it might better to look at using a more generic cache rather than doing something with tempdata or session in each action.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜