views:

64

answers:

2

Hi all,

I'm using MVC, I've got a search page, and I want to pass multiple arguments to the next page.

I want to wrap these multiple parameters into an Object (CV) and pass it to the next screen, not just pass all the args individually via the query string.

I'm sure there are lots of ways to skin this cat, but what's the MVC approved best practice?

Can anyone point me to any links with examples, and or discussing the why's of the best practice?

If there is not a best practice, how do you recommend doing it and why?

I'd like the get on the new controller method to look like this

[AcceptVerbs( HttpVerbs.Get )] public ActionResult FixUser( FixUserCv userInput ) { ... }

I thought this would be an easy google but I'm not finding it, so I came here.

Thanks!

Eric-

A: 

When the search page is submitted, can you put the parameters in the model that you send to the next view? I would think that would be the ideal way to do it.

Eric Petroelje
+1  A: 

Use TempData.

TempData is a lightweight data store which provides next request with the data that you stored and purges it afterwards.

TempData["searchParams"] = someParams;
return RedirectToAction("Index");

When Index runs you can read the data from TempData["searchParams"].

Vnuk