I am newer to MVC3 and have a controller with one action.I defined some global properties in controller class and assigned values to those properties in action method. ex:
public class RosterController : Controller
{
int var1;
int var2;
int var3;
public ActionResult Index(int param1)
{
if(param1 ==1)
{
return view(newRosterViewModel(var1+1,var2+2,var3+3));
}
else
{
var1=1;
var2=2;
var3=3;
return view(newRosterViewModel(var1,var2,var3));
}
}
}
In this code first time assigning values to var1,var2,var3. second time I need those vaues but values are null.
I tried with TempData but that also not holding value.