Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if (TempData["p"] != null || TempData["A"] != null || TempData["B"] != null || TempData["C"] != null)
{
ViewBag.Message = string.Format("Your Added/Updated details has been Saved successfully.");
return View("~/Views/Mob_App/TradeNoticeView.cshtml", obj.ToList());

TempData.Remove["p"]

}

What I have tried:

it is not Working to Remove Temp Data so
how to Remove TempData Value
Posted
Updated 15-Feb-18 22:48pm

1 solution

Remove is method, not an array. Just mas as string argument what you want to remove
C#
TempData.Remove("p")
 
Share this answer
 
Comments
Member 12183079 16-Feb-18 5:24am    
get exception
temp data directory controller base.tempdata get and set the directory for temporary data
Bohdan Stupak 16-Feb-18 5:59am    
Could you exactly post which exception do you get? I can't figure out anything from this set of words :(
Member 12183079 16-Feb-18 5:25am    
an can i remove
TempData.Remove("p");
TempData.Remove("A");
TempData.Remove("B");
TempData.Remove("C");
Member 12183079 16-Feb-18 6:05am    
no it is working
thank you
Bohdan Stupak 16-Feb-18 6:06am    
you are welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900