Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to pass array in asp.net(c#) from one page to other?

How to pass array in asp.net(c#) from one page to other?

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netdata-structurestutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pradeepsimha
    wrote on last edited by
    #1

    Hi friends i have one serious problem i m unable to pass an array like string[] seatLayout=new string[100]; from one page named SelectBus.aspx to PassDetails.aspx.....i m stuked there? i need to pass array from one page to another. Can any one please help? :(( :((

    Y C P J 4 Replies Last reply
    0
    • P pradeepsimha

      Hi friends i have one serious problem i m unable to pass an array like string[] seatLayout=new string[100]; from one page named SelectBus.aspx to PassDetails.aspx.....i m stuked there? i need to pass array from one page to another. Can any one please help? :(( :((

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      well there are several ways you can pass data between pages, Query String, Session variables etc. string[100] is potentially huge data, depending on the content of each element. Why don't you persist the data to either database or file and pass a handle from one page to another page1.aspx: Save string[100] to database then call page2.aspx?id=some_id

      ɟnsnʎ ʎlʇuǝƃıllǝʇuı uoıʇsǝnb ɐ ʞsɐ oʇ ʍoɥ [^]

      1 Reply Last reply
      0
      • P pradeepsimha

        Hi friends i have one serious problem i m unable to pass an array like string[] seatLayout=new string[100]; from one page named SelectBus.aspx to PassDetails.aspx.....i m stuked there? i need to pass array from one page to another. Can any one please help? :(( :((

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Your first question is, why do you need to pass this array ? You should probably store it in a DB, and pass the id used to pull it from the DB. Having said that, you could concievably place the array on the URL, or use the Session.

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

        1 Reply Last reply
        0
        • P pradeepsimha

          Hi friends i have one serious problem i m unable to pass an array like string[] seatLayout=new string[100]; from one page named SelectBus.aspx to PassDetails.aspx.....i m stuked there? i need to pass array from one page to another. Can any one please help? :(( :((

          P Offline
          P Offline
          pradeepsimha
          wrote on last edited by
          #4

          simply i m given it as [100] but i need only 5 to 10 thats all......because in one page user will select seats in the bus for reservations i need to pass these values to next page thats all...........

          1 Reply Last reply
          0
          • P pradeepsimha

            Hi friends i have one serious problem i m unable to pass an array like string[] seatLayout=new string[100]; from one page named SelectBus.aspx to PassDetails.aspx.....i m stuked there? i need to pass array from one page to another. Can any one please help? :(( :((

            J Offline
            J Offline
            jai_101
            wrote on last edited by
            #5

            Hi, You can Use Querystring for Passing Array from one Page to Another page. I hope the following Sample Code will Help You. Let's start by creating the array in CreateArray.asp 'Create an array that contains 'the days of the week Dim aWeekDays(6) aWeekDays(0) = "Sunday" aWeekDays(1) = "Monday" aWeekDays(2) = "Tuesday" aWeekDays(3) = "Wednesday" aWeekDays(4) = "Thursday" aWeekDays(5) = "Friday" aWeekDays(6) = "Saturday" Now, to store the array contents in the querystring, we will loop from LBound(aWeekDays) to UBound(aWeekDays). For each element, we'll add an item to the querystring, having the array name, an equals sign, and then the value of the particular array element. 'Build the querystring Dim iLoop, strQueryString For iLoop = LBound(aWeekDays) to UBound(aWeekDays) strQueryString = strQueryString & "WeekDays=" & aWeekDays(iLoop) strQueryString = strQueryString & "&" Next 'Cut off the last character strQueryString = Left(strQueryString, Len(strQueryString) - 1) 'Now, create the actual hyperlink %> ReceiveArray.asp Bye Jai

            P 1 Reply Last reply
            0
            • J jai_101

              Hi, You can Use Querystring for Passing Array from one Page to Another page. I hope the following Sample Code will Help You. Let's start by creating the array in CreateArray.asp 'Create an array that contains 'the days of the week Dim aWeekDays(6) aWeekDays(0) = "Sunday" aWeekDays(1) = "Monday" aWeekDays(2) = "Tuesday" aWeekDays(3) = "Wednesday" aWeekDays(4) = "Thursday" aWeekDays(5) = "Friday" aWeekDays(6) = "Saturday" Now, to store the array contents in the querystring, we will loop from LBound(aWeekDays) to UBound(aWeekDays). For each element, we'll add an item to the querystring, having the array name, an equals sign, and then the value of the particular array element. 'Build the querystring Dim iLoop, strQueryString For iLoop = LBound(aWeekDays) to UBound(aWeekDays) strQueryString = strQueryString & "WeekDays=" & aWeekDays(iLoop) strQueryString = strQueryString & "&" Next 'Cut off the last character strQueryString = Left(strQueryString, Len(strQueryString) - 1) 'Now, create the actual hyperlink %> ReceiveArray.asp Bye Jai

              P Offline
              P Offline
              pradeepsimha
              wrote on last edited by
              #6

              but how to retrieve the elements in the next page?????? :( :sigh: :^) :( :sigh: :((

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups