views:

640

answers:

1
+1  A: 

I can answer to your first question:

public ActionResult ContinueToCorr(string Number, string Rev)
{
    ViewData["DivIsVisible"] = true;
    return RedirectToAction("../Wizard/Index/1");
}

You are using RedirectToAction, that clears all ViewData. Instead, use:

public ActionResult ContinueToCorr(string Number, string Rev)
{
    ViewData["DivIsVisible"] = true;
    return Index(1);
}

I'm assuming that you have an ActionResult called Index that takes an Int parameter, in your Wizard controller.

Francisco
In my Index() (In this case, this Index has no parameters), I just have a return View(); call, yet when I do that I get an error saying that it cannot find ContinueToCorr.aspx in any location. I thought that if you had a return View() under a function, it looked for the View that was named for that function, in this case Index, no? Am I missing something?
dangerisgo
Also what would I pass into Index with the parameters?
dangerisgo
Not always... if you want to force the rendered view, put return View("Index");I don't understand your second comment. I thought you wanted to pass a "1" into your Index action, because of the routing /Wizard/Index/1 you put there.
Francisco
So I'm still a bit lost as to how to show/hide divs. I have my setup now so that I pass in the action so lets say the address will be: localhost:xxxx/Wizard/Selection which would call the Selection function. A much better solution, and implementable. But still not sure on how to pass the viewData so that I can show/hide a div.
dangerisgo
so right now I have one index function which will return View();. When I call return Index(); from the ContinueToCorr function, it does in fact call the Index() function but instead of returning the Index view, it still wants to return the ContinueToCorr view.
dangerisgo
It depends. If you only want to hide it, just use CSS classes (display:none). Pass your CSS from your viewdata, like viedata["divToBeHidden"]="class='hiddenCSS'"; Just and idea though.Also, did you put return View("Index") instead of return View()? in your ActionResult Index?
Francisco