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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Help!! passing data from the form through page???

Help!! passing data from the form through page???

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestion
4 Posts 2 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.
  • C Offline
    C Offline
    cool_man
    wrote on last edited by
    #1

    In 1.aspx page I have a form:

    I want passing data when user submit to the 2.aspx page. How a programer .net usually do it? Have anyone help me please?

    R 1 Reply Last reply
    0
    • C cool_man

      In 1.aspx page I have a form:

      I want passing data when user submit to the 2.aspx page. How a programer .net usually do it? Have anyone help me please?

      R Offline
      R Offline
      Ray Williams II
      wrote on last edited by
      #2

      Although I do not recommend this approach to coding in ASP.NET, you can use the Server.Transfer method to expose the sending page to the receiving page. Using this method can lead to some misleading results in your web browser. Specifically, the address bar in your web browser will still show the address of the sending page, even though the receiving page's content is being displayed. If possible, I would have the code-behind for the initial page handle the processing of its own data and redirect to subsequent pages as needed.

      C 1 Reply Last reply
      0
      • R Ray Williams II

        Although I do not recommend this approach to coding in ASP.NET, you can use the Server.Transfer method to expose the sending page to the receiving page. Using this method can lead to some misleading results in your web browser. Specifically, the address bar in your web browser will still show the address of the sending page, even though the receiving page's content is being displayed. If possible, I would have the code-behind for the initial page handle the processing of its own data and redirect to subsequent pages as needed.

        C Offline
        C Offline
        cool_man
        wrote on last edited by
        #3

        Thanks, But How do I save the value from the form to another page aspx? EX: txtName.value txtAddress.value In 2.aspx I can't call that...

        R 1 Reply Last reply
        0
        • C cool_man

          Thanks, But How do I save the value from the form to another page aspx? EX: txtName.value txtAddress.value In 2.aspx I can't call that...

          R Offline
          R Offline
          Ray Williams II
          wrote on last edited by
          #4

          ASP.NET TextBox Web Controls store their value in the Text property not the Value property. If the textbox controls are not available for processing in 2.aspx. You can push the values of the text boxes into Session variables and access them from any subsequent page (2.aspx, 3.aspx, etc.) In the postback event for 1.aspx, capture the values for your text controls and redirect. C#:

          Session["1aspx_txtName"] = txtName.Text;
          Session["1aspx_txtAddress"] = txtAddress.Text;
          Response.Redirect["2.aspx"];

          VB.NET:

          Session("1aspx_txtName") = txtName.Text
          Session("1aspx_txtAddress") = txtAddress.Text
          Response.Redirect("2.aspx")

          The session variables will be available for the extent of the users connection to the web site. Subsequent pages may access the values in the following manner. C#:

          String previousName = (String)Session["1aspx_txtName"];
          txtNewAddress.Text = (String)Session["1aspx_txtAddress"];

          VB.NET:

          Dim previousName as String = CType(Session("1aspx_txtName"),String)
          txtNewAddress.Text = CType(Session("1aspx_txtAddress"),String)

          You will want to limit the number of Session variables you create. They will take up memory on you server until unloaded when the users leaves the site.

          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