How to convert NameValue Collection when using ViewState

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to store a NameValue collection within a ViewState like this:
StoreFilterSelection = ViewState["StoreFilterSelection"];

YEt I recieve an error "Cannot implicityly convert type 'system.type' to
'system.collections.specialized.nameValueCollection".

Can I store a NameValuecollection in a viewstate and how can I read what is
save in this collection so I can update it from page to page.
 
Hi,
Assign the collection directly to the view state as in
ViewState["StoreFilterSelection"] = StoreFilterSelection;

While retrieving it, typecast explicitly:
StoreFilterSelection =
(NameValueCollection)(ViewState["StoreFilterSelection"]);

HTH.

"Nicole - ASP/C# Beginner" <[email protected]>
wrote in message Hi,

I am trying to store a NameValue collection within a ViewState like this:
StoreFilterSelection = ViewState["StoreFilterSelection"];

YEt I recieve an error "Cannot implicityly convert type 'system.type' to
'system.collections.specialized.nameValueCollection".

Can I store a NameValuecollection in a viewstate and how can I read what is
save in this collection so I can update it from page to page.
 
Back
Top