vote up 1 vote down
star
2

Is there a way to link to another View that displays search results without having to use a querystring? For example, I know that I can do the following:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(string txtOrderNumber)
{
    return RedirectToAction("OrderLookup", new { controller = "Report", id = txtOrderNumber });            
}

But, let's say that I only want to use a hyperlink (a hyperlink with the Order Number) and not a form post. How can I route to the result View without using a querystring? many thanks.

offensive?
add comment

1 Answer:

vote up 0 vote down
check

Rename the txtOrderNumber argument to id. Then it will get picked up by the default route. Alternately, introduce a new route with a value called txtOrderNumber in the same place as the id value in the default route, and constrain it to respond to only this controller.

link|offensive?
comments (4)

Your Answer:

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.