问题描述:

I have an ActionResult return type inside my Controller which executes the default Index action.

public **ActionResult** Index(int _page, string **tabIdx**)

{

if (tabIdx == null)

ViewData.Add("TabIdx","0");

else

ViewData.Add("TabIdx", tabIdx);

**actionResult = View("Index");**

return actionResult;

}

The ViewData variable is for processing inside my javascript, so you can ignore it for the purpose of this question.

What I need to do is to simply pass a querystring value for the tabIdx field in the above boldfaced line of code.

Something like View("Index") with a querystirng value appened to it.

How can I accomplish this?

网友答案:

You will have to use RedirectToAction. The URL already is set in stone after the request.

However, there might be a way to pass that value somewhere else so that it can be used without a redirect.

相关阅读:
Top