views:

173

answers:

2

I have Dim a(15) as integer i wont to save this array in Viewstate .

A: 

You just need to assign this variable to ViewState with a given key. Note that when you attempt to access the variable, you will need to cast it to the appropriate type.

Here's a link specific to your question: http://www.kaelisspace.com/wordpress22/2008/04/07/saving-objects-in-viewstate-for-postbacks-vbaspnet/

Tejs
+1  A: 

Save it like this:-

ViewState("MyArray") = a

Access it like this:-

a = CType(ViewState("MyArray"), Integer())

I'm a C# guy might be mistaking in VB.NET code. Please do correct me.

Ismail
Does't need to cast ViewState("MyArray")
Haroldis
Thanks for pointing out. I had missed it. Now corrected.
Ismail