scott_m
scott_m

Reputation:

how to return an asp.net mvc view with a query string?

In Asp.NET MVC, how do you make your controller return a view with a query string?

thanks

Upvotes: 0

Views: 3099

Answers (3)

Hari Gillala
Hari Gillala

Reputation: 11916

Use this

return RedirectToAction("AmendAbsence", new RouteValueDictionary (new  {  Controller ="Absence", Action="AmendAbsence", Id=id }));

Configure your Global.asmx appropriately

thanks

Upvotes: 0

Matt Kocaj
Matt Kocaj

Reputation: 11535

This should get you started with returning views. And this tutorial should show you how params can be passed into actions to generate specific results.

Upvotes: 0

James Avery
James Avery

Reputation: 3012

It might be better if you post what you are trying to accomplish. The simple answer is that you can't, the querystring is part of the request so if you wanted to do that you would need to redirect to your view with the querystring as part of the URL... but it sounds like you are perhaps trying to use the querystring to pass data to the view? If so you are much better off using ViewData.

Upvotes: 1

Related Questions