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. Passing Form data to another page

Passing Form data to another page

Scheduled Pinned Locked Moved ASP.NET
sales
12 Posts 6 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.
  • M Offline
    M Offline
    munklefish
    wrote on last edited by
    #1

    Hi, I have a page with some info on it, including a customer details form. When the user clicks the submit button, they are redirected to a second page* (using the button postbackurl property). On this new page i wish to recall the data the user input into the form. I know that i should use 'Requet.Form["field name"]', for this but i dont know what the field will be called. At present iam using this: Literal1.Text = Request.Form["TextBox2"]; However this is not returning any text. Please can you sgive me some idea of where im going wrong. Many Many Thanks! *I have to do this so please dont suggest i do it differently. Thanks.

    H V K 3 Replies Last reply
    0
    • M munklefish

      Hi, I have a page with some info on it, including a customer details form. When the user clicks the submit button, they are redirected to a second page* (using the button postbackurl property). On this new page i wish to recall the data the user input into the form. I know that i should use 'Requet.Form["field name"]', for this but i dont know what the field will be called. At present iam using this: Literal1.Text = Request.Form["TextBox2"]; However this is not returning any text. Please can you sgive me some idea of where im going wrong. Many Many Thanks! *I have to do this so please dont suggest i do it differently. Thanks.

      H Offline
      H Offline
      Herman T Instance
      wrote on last edited by
      #2

      Find any info on ViewState or Session objects

      E M 2 Replies Last reply
      0
      • H Herman T Instance

        Find any info on ViewState or Session objects

        E Offline
        E Offline
        eyeseetee
        wrote on last edited by
        #3

        string sttestbox = textbox1 Session["Sessioname"] = sttestbox;

        M 1 Reply Last reply
        0
        • M munklefish

          Hi, I have a page with some info on it, including a customer details form. When the user clicks the submit button, they are redirected to a second page* (using the button postbackurl property). On this new page i wish to recall the data the user input into the form. I know that i should use 'Requet.Form["field name"]', for this but i dont know what the field will be called. At present iam using this: Literal1.Text = Request.Form["TextBox2"]; However this is not returning any text. Please can you sgive me some idea of where im going wrong. Many Many Thanks! *I have to do this so please dont suggest i do it differently. Thanks.

          V Offline
          V Offline
          varun g
          wrote on last edited by
          #4

          Friend ,..You can use 'request.querystring' method to call the second page's value to other ...

          M 1 Reply Last reply
          0
          • V varun g

            Friend ,..You can use 'request.querystring' method to call the second page's value to other ...

            M Offline
            M Offline
            munklefish
            wrote on last edited by
            #5

            I dont really want to use QueryString as its open to abuse. Thanks anyway.

            1 Reply Last reply
            0
            • E eyeseetee

              string sttestbox = textbox1 Session["Sessioname"] = sttestbox;

              M Offline
              M Offline
              munklefish
              wrote on last edited by
              #6

              I cant really use sessions as i am using them for a whole load of orders etc. Thanks for the suggestion.

              H 1 Reply Last reply
              0
              • H Herman T Instance

                Find any info on ViewState or Session objects

                M Offline
                M Offline
                munklefish
                wrote on last edited by
                #7

                Care to shed any more light, with reference to my question? Thanks.

                1 Reply Last reply
                0
                • M munklefish

                  I cant really use sessions as i am using them for a whole load of orders etc. Thanks for the suggestion.

                  H Offline
                  H Offline
                  Herman T Instance
                  wrote on last edited by
                  #8

                  creat an order object class. fill the class for each order as soon as one order is filled add the order to an ArrayList. In the session object you can objects. So you can add an ArrayList to 1 session0bject. In the second page cast that session object to an ArrayList and you can reach your data.

                  F 1 Reply Last reply
                  0
                  • M munklefish

                    Hi, I have a page with some info on it, including a customer details form. When the user clicks the submit button, they are redirected to a second page* (using the button postbackurl property). On this new page i wish to recall the data the user input into the form. I know that i should use 'Requet.Form["field name"]', for this but i dont know what the field will be called. At present iam using this: Literal1.Text = Request.Form["TextBox2"]; However this is not returning any text. Please can you sgive me some idea of where im going wrong. Many Many Thanks! *I have to do this so please dont suggest i do it differently. Thanks.

                    K Offline
                    K Offline
                    Krishnraj
                    wrote on last edited by
                    #9

                    Hi dear, Have u tried using Server.Transfer and HttpContext just see the below exa. there is one textbox in yr form and u want that textbox value in another page. for that do the following..

                    HttpContext.Current.Items("txt1") = Txt1.Text; //--- yr form textbox
                    Server.Transfer("anotherPage.aspx");

                    -------------- To access data in anotherPage.aspx

                    string txt1 = HttpContext.Current.Items("txt1").toString();

                    I hope it will help u.. regards

                    Rana Krishnraj

                    M 1 Reply Last reply
                    0
                    • K Krishnraj

                      Hi dear, Have u tried using Server.Transfer and HttpContext just see the below exa. there is one textbox in yr form and u want that textbox value in another page. for that do the following..

                      HttpContext.Current.Items("txt1") = Txt1.Text; //--- yr form textbox
                      Server.Transfer("anotherPage.aspx");

                      -------------- To access data in anotherPage.aspx

                      string txt1 = HttpContext.Current.Items("txt1").toString();

                      I hope it will help u.. regards

                      Rana Krishnraj

                      M Offline
                      M Offline
                      munklefish
                      wrote on last edited by
                      #10

                      Rana, Thanks for the suggestion. I have 6 textboxes i need cross page access to. Will this work with all 6 textboxes? Also do i need to dispose of the items in Context after use? Thanks!!!

                      K 1 Reply Last reply
                      0
                      • M munklefish

                        Rana, Thanks for the suggestion. I have 6 textboxes i need cross page access to. Will this work with all 6 textboxes? Also do i need to dispose of the items in Context after use? Thanks!!!

                        K Offline
                        K Offline
                        Krishnraj
                        wrote on last edited by
                        #11

                        Hi, Yes of-course it is possible for all 6 textboxes. for demo purpose i write the code for one textbox only, ok. after using of Context no need to dispose them, but according to yr requirement u have to clear HttpContext. Regards,

                        Rana Krishnraj

                        1 Reply Last reply
                        0
                        • H Herman T Instance

                          creat an order object class. fill the class for each order as soon as one order is filled add the order to an ArrayList. In the session object you can objects. So you can add an ArrayList to 1 session0bject. In the second page cast that session object to an ArrayList and you can reach your data.

                          F Offline
                          F Offline
                          ffowler
                          wrote on last edited by
                          #12

                          This is a great tip for something else I was working on. Thanks for posting it digimanus.

                          digimanus wrote:

                          creat an order object class. fill the class for each order as soon as one order is filled add the order to an ArrayList. In the session object you can objects. So you can add an ArrayList to 1 session0bject. In the second page cast that session object to an ArrayList and you can reach your data.

                          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