How to get the controller session value in layout page
Can any one tell me how to get the controller session value in layout page
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
suraj ghosiPosted Apr 30, 2015, 2:14 AM
public actionresult mycontroller()
{
viewbag["myvalue"]="this is test value";
retrun view();
}
in your layout page my.cshtml. you can access the viewbag value
@Html.LableFor(@viewbag["myvalue"])