.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How do you store multi-dimensional array to viewstate?

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net

How do you store multi-dimensional array to viewstate?  I am having a problem.  Here's what I did:

public bool[,,] regsettings = new bool[7,5,4];

bool[,,] regsettings = (bool[,,])ViewState["regsettings"];    // this line works!

regsettings[i,j,tab] = (bool)ViewState["regsettings"]; // this line no working?! The error is: Object reference not set to an instance of an object

the letters i,j,tab are just variables in the loop.  They are there.

I also tried: (bool[,,,]) as a cast and it is a no-go either.?


View Complete Post

More Related Resource Links

How to create a multi dimensional array in VB .net

 How do I create a multi dimensional array in visual basic. For example I have a soccer team with players. Each player has an id, first name, last name, address, phone number. How would I represent this using a multi dimensional array?

Is it possible to store objectdatasource in session or viewstate to use on another page?

Im building my objectdatasource on different button events.. so id like to know if i can store that or the results in a session or viewstate so i can use it on a pop-up window. explanation: User arrives at our page. They select or enter specific information to search.. results found are presented in a gridview, that is currently bound to the objectdatasource. Within that gridview i will be adding a button to open a new window that will display a googlemap with the location marked on the map. Also will be adding a button to view all the results on the map. So if your search returns 10 records and you want to see all 10 marked on the map, they can click the "View All" button and they are all marked on the map.. Or if you want to just view 1 at a time, you select that record and it display just that record on the map.   So not sure what i should do to accomplish this.

Help with multi-dimensional dynamic datagrid in ASP.NET

I'm designing a web application in ASP.NET and I have the requirement of a dataset that expands in two directions.  The user can add any number of rows vertically, while scrolling through dates horizontally.  An extremely simplified version of the scenario would look something like:                           <---   9/1/2010  - -->Customer           # of orders   Total $John                         1         $10Bill                            2         $50Dave                         1         $30Mary                         5     

how to store array values into datarow


Hi I have   string array values in


Dim _arr_Entry_Ids() As String = Split(_Entry_Id, ",")

i want to store this array values in datatble column

dt = New DataTable


For i as integer 1 to 5

dr("v1") = _arr_Entry_Ids

dr("R1")="some text"


How to call multi store prcedure in one function



Thanks for all helps before!

I have several store procedure to do different things. When user click submit button, call store_procedureOne, store_procedureTwo, store_procedureThree.

Here is my code.

protected void ButSubmit_Click(object sender, EventArgs e)
        OleDbConnection myConnection = new OleDbConnection(connStr);
        OleDbCommand myCommandUpdate = new OleDbCommand("store_procedureOne");
        myCommandUpdate.Connection = myConnection;
        myCommandUpdate.CommandType = CommandType.StoredProcedure;
        Server.Transfer("NextPage.aspx", true);

I do not know how to add store_procedureTwo and store_procedureThree at

OleDbCommand myCommandUpdate = new OleDbCommand("store_procedureOne");

I appreciated it very much if you could help me out!

Creating a One-Dimensional Array for use with AddUsersToRoles Method


Dear All

I've created an Excel spreadsheet for my users to upload into my web application to bulk import  memberships and roles into the application. There are up to 4 different roles which users can be members of so I'm using AddUsersToRoles to add the user to one or more roles in one line of code like this:

r.AddUsersToRoles(usernames, CreateListOfRoles(Role1, Role2, Role3, Role4))

As this line of code expects a one-dimensional array of roles, I have created a function to take in the roles from my spreadsheet, add them into a one-dimensional array, and return that to the AddUsersToRoles method. The CreateListOfRoles function looks like this:

    Function CreateListOfRoles(ByVal Role1 As String, ByVal Role2 As String, ByVal Role3 As String, ByVal Role4 As String) As Array

        Dim ar As New ArrayList

        'If the role boxes are not blank, add them to the array
        If Not String.IsNullOrEmpty(Role1) Then
        End If

        If Not String.IsNullOrEmpty(Role2) Then
        End If

        If Not String.IsNullOrEmpty(Role3) Then
        End If

        If Not String.IsNullOrEmpty(Role4) Then
        End If


multi dimensional arrays???


I have the following code in which I pass 1 value in the array after comparing 2 data tables.

Now how do I pass all the values from the data tables rows (like docfiletype, docseqid) in one array(or should I use something else)? so that I can sort the array based on docseqid?


Dim ls_attachment_filename() As String = Nothing
 Dim li_attachment_count As Integer
Dim j As Integer
For j = 0 To leadrowcount - 1

                        Dim docidatt As String = recordDatatable.Rows(j).Item(0).ToString
                        Dim docredid As String = recordDatatable.Rows(j).Item(1).ToString
                        Dim docfiletype As String = recordDatatable.Rows(j).Item(2).ToString
                        Dim docsize As String = recordDatatable.Rows(j).Item(3).ToString
                        Dim docseqid As String = recordDatatable.Rows(j).Item(4).ToString
                        Dim k As Integer
                        For k = 0 To rowcasecount - 1
                            Dim caseidatt As String = caseDatatable.Rows(k).Item(0).ToString
                            Dim caseredid As String = caseDatatable.Rows(k).Item(1).ToString
                            Dim casefiletype As String = caseDatatable.Rows(k).Item(2).ToString
                            Dim casesize As String = caseDatatable

how Save int array in viewstate


how save int array in viewstate please give solution?

how to store the datatable values into the 1-D array


hi all ,

how to store the datatable values into the 1-D array , i know in for loop ... other than that is there means let me know please

what are relational and multi-dimensional format?

I read an interview question:
"In which format SSAS stores data?"

Well, I remeber having read, that ROLAP stores and operates their data and metadata in  relational format (OLTP relational database) that permits to use SQL, above of only MDX for SSAS storage.

What are exactly relational  and multi-dimensional (SSAS) formats?
What are details of their storage, resp., and what are the differences? 

Multi Valued Fields flooding the term store



In the User Profile store we have lots of multivalued properties. Somehow it seems like all the values for the Multi Value fields for user profiles are getting auto populated in the term store.

Can some one explain if by default Multivalued attributes get added to term store?

Also how to disable this behavior. We do not want some of the multivalued fields to get added to the Term Store.



Multi-threading in .NET: Introduction and suggestions

This article uses the C# type shorthands throughout - int for Int32 etc. I hope this makes it easier for C# developers to read, and won't impede any other developers too much. It also only talks about the C# ways of declaring variables to be volatile and locking monitors. Developers using other languages can find the equivalents in their own preferred environment, I'm sure.

Multi File Upload Using JQuery!

Everyone knows about the file upload in .NET. But the multi file upload is some what difficult in .NET. For that purpose we can have some AJAX or JQuery!. Jquery is the latest advanced version. It will give some animated upload. You can try it for your own!!!!

Store and Display Images from MS Access Database Using C#

There is only the difference of coding syntax to stream the binary data of image content type to upload it into MS Access Database using C#/VB in ASP.Net 2.0

Namespaces required:-
using System.Data.OleDb;

OleDb is used to connect the web site forms with MS Access Database using Microsoft.Jet.OLEDB.4.0

Binding an array to dropdown list


I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      


allLinks = newAllLinks
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks


 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8

how to get an array of all the asp.net textbox control inside create user wizard control?



How can I get all the textboxes inside a create user wizard control using getElementsByTagName().

Below is my JQuery code:

<script type="text/javascript">
        function addLoadEvent(func) {
            var oldonload = window.onload;
            if (typeof window.onload != 'function') {
                window.onload = func;
            } else {
                window.onload = function() {

        function prepareInputsForHints() {
            var inputs = document.getElementsByTagName("asp:TextBox");
            for (var i = 0; i < inputs.length; i++) {
                inputs[i].onfocus = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
                inputs[i].onblur = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "none";



<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

How to store more than 4k bytes of data in SQL CE 4?


I need to store more than 4k of bytes in my SQLCE 4 database. How can I do that with the ASP.NET Web Pages 1.0?

1: The Microsoft.Data provider fails when I try to populate a parameter with more than 4k bytes.
2: Referencing SqlServerCe assembly and using SqlCeConnection/SqlCeCommand/SqlCeParameter throws exception:  SQL Server Compact is not intended for ASP.NET development.

How can I somehow map the generic DbType, which does not have NText as an option, to the ntext column in my database? (SqlCeParameter supports DbSqlType, which has ntext, but see problem #2)

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend