Tag Archives: asp.net mvc

Understanding TempData in detail

What is TempData? Tempdata let us maintain data within single request cycle Example: publicActionResult M1() { TempData[“a”] = “Value”; string s = TempData[“a”].ToString(); returnRedirectToAction(“M2”); } publicActionResult M2() { string s = TempData[“a”].ToString(); // Data will be available returnRedirectToAction(“M3”); } publicActionResult M3() { string s = TempData[“a”].ToString(); // Data will be available returnview (“Some View”); //

Read More

%d bloggers like this: