The view is a partial view and it's rendered within the grid editor. If I will check the TempData in the master view it works. But if I will check the TempData in the Partial View it doesn't work.
How I can get the TempData value in a partial view which is rendered from grid editor?
Then check if the Session exist and has a specific value:
if(Session["mySessionVar"]!=null && Session["mySessionVar"]=="myValue")
{
// enter code here
// and set the session variable to null if you don't need this anytime
Session["mySessionVar"] = null;
}
hi has anyone had any luck finding a solution to this? I have the same issue where im setting tempdata in the controller and its always empty in the macro i am using for the view.
TempData is always empty
Hello,
my TempData in a view is already empty: "Enumeration yielded no results".
I set the TempData in my controller:
And I will check the TempData in my view:
Umbraco Version: 7.2.8
I search for a solution since a few hours, but can't figure it out how it will works. The same code I have use a lot of times before without problems.
Has anyone an idea?
Cheers, Sören
More details:
The view is a partial view and it's rendered within the grid editor. If I will check the TempData in the master view it works. But if I will check the TempData in the Partial View it doesn't work.
How I can get the TempData value in a partial view which is rendered from grid editor?
Cheers, Sören
No good solution, but a temporary workaround:
Now, we use a session variable instead of TempData.
I have the exact same problem. Im trying to render a macro through the grid, but after the post to the surfacecontroller the TempData is always empty.
Could you show me your code on how you have done it with the session variable as a temporary fix?
Hi Anne,
you can set a session variable like this:
Then check if the Session exist and has a specific value:
Hope this helps?
Best, Sören
I just have the problem that my macro gets rendered two times after a post (I dont know why). So i do not have any options to clear the session.
hi has anyone had any luck finding a solution to this? I have the same issue where im setting tempdata in the controller and its always empty in the macro i am using for the view.
is working on a reply...