473,385 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Add an array to ViewState

Folks,

How to add an array to a ViewState in C#?

I'm doing the following and .net does not likes it.

ViewState["HeadingArray"] = HeadingArray;

where HeadingArray is a two dimensional array.

Any thoughts is really appreciated. thanks....

I also tried

ViewState["HeadingArray"] = (object) HeadingArray;

but no use..it still throws error.
Nov 18 '05 #1
2 4004
This doesn't sound like something to put into the viewstate. Does it advise
you to implement a type converter? You could try going that route,
implement a type converter to string-ify your array...

"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
Folks,

How to add an array to a ViewState in C#?

I'm doing the following and .net does not likes it.

ViewState["HeadingArray"] = HeadingArray;

where HeadingArray is a two dimensional array.

Any thoughts is really appreciated. thanks....

I also tried

ViewState["HeadingArray"] = (object) HeadingArray;

but no use..it still throws error.

Nov 18 '05 #2
It simply says invalid cast....doesn't even give a line number...

What's funny is this works perfectly with one dimension arrays. Only
with two dimensions and more it gives this error.

I have circumvented this problem by using two one dimension arrays for
now.

But still wondering if there is a technical reason behind it.

Thanks...

"Damon Payne" <da***@damonpayne.com> wrote in message news:<Js*****************@twister.rdc-kc.rr.com>...
This doesn't sound like something to put into the viewstate. Does it advise
you to implement a type converter? You could try going that route,
implement a type converter to string-ify your array...

"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
Folks,

How to add an array to a ViewState in C#?

I'm doing the following and .net does not likes it.

ViewState["HeadingArray"] = HeadingArray;

where HeadingArray is a two dimensional array.

Any thoughts is really appreciated. thanks....

I also tried

ViewState["HeadingArray"] = (object) HeadingArray;

but no use..it still throws error.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
0
by: wASP | last post by:
I thought it was something relatively simple: ViewState = SomeObj; Then: SomeObj = ViewState; So, in my own code, I have this on the initial load:
1
by: John Miller | last post by:
I'm developing a form that captures patient information. In the form, I need the ability to add several insurance policies. The approach I have decided to take is to load the separate insurance...
1
by: bob | last post by:
I am a newbie. How do I add an array to a viewstate, then retreive the individual elements? Right now, I made an array with random numbers and when I go to access an element from different...
4
by: Robert P. | last post by:
I can easily store a one-dimensional array in viewstate ( see Test1 ) If I try storing a multi-dimensional array in the viewstate it's crapping out on me when it goes to serialize the array (not...
5
by: danc | last post by:
I keep getting this error. I have scoured the web and could not find any applicable information. It seems to have really started since I upgraded to the 1.1 framework. Any help is appreciated. ...
0
by: Jennyfer J Barco | last post by:
Hello I'm trying to save an array into a viewstate, but I'm getting the error "Specified cast is not valid". The statement I'm using is Public profarray(,) As String 'defining the array ...
2
by: =?Utf-8?B?VG9kZCBKYXNwZXJz?= | last post by:
Hey guys, Can anyone tell me how I can do THIS (see code below) but in a STRING ARRAY instead? I really appreciate any help. I'm using C# in VS2005. public int intTotal { get {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.