开发者

Redisplaying old data on a view mvc

I have an MVC application in which I create a search page to find projects I've created. Once the user enters the search criteria, the data is passed back to the controller as a model object and I take this data to search for any projects that match. The search page is redisplayed with the original criteria the user entered plus any projects that were found. The user can now go an click on a row (the results of their search) and edit that data on another page. When the user hits the save but开发者_开发百科ton (on the other page), I save the data and go back to the search page. I don't have the original data (the search model object) to redisplay. How do I get it back? I'm thinking that I should just thorugh my model object that I got when the method was called through the controller into my session object and then retrieve it when I come back to the search page. Is there a more elegant solution to getting the data from the model object back when I return to the search page?


You can use TempData["whatevever"]= yourObject and the data there will exist until it is read the next time and then it is removed. Its like the session object, but is removed after you read it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜