Reputation: 1082
I'm trying to access a Dictionary in my View . But the following syntax :
@{
var indexList = Viewbag.IndexList as Dictionary<int,long>;
}
doesnt work : The name 'Viewbag' does not exist in the current context
P.S. :Tried placing '@' before Viewbag ,still doesn't work.
Can someone help ? Thanks in advance
Upvotes: 0
Views: 6241
Reputation: 2802
Try this way:
var indexList = this.ViewBag.IndexList as Dictionary<int,long>;
Upvotes: 0
Reputation: 5576
is it not ViewBag?
var indexList = ViewBag.IndexList as Dictionary<int,long>;
Upvotes: 5