views:

13

answers:

1

Hello,

I am trying to cache a selectlist which is not null but I get a null exception error. The line of code causing the error is: (note item is created using Cache item = new Cache(); and tripVM.friendDropDown holds the selectlist

   item.Insert("friendDropDown", tripVM.friendDropDown,null,DateTime.Now.AddMilliseconds(10000), TimeSpan.Zero);

Most of the online resources say that I could use the syntax below but this is not allowed in VS2010 using .NET 4.0:

   cache["friendDropDown"] = tripVM.friendDropDown;

Where is this error coming from?

thanks