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. Posting value from one page to another

Posting value from one page to another

Scheduled Pinned Locked Moved ASP.NET
question
10 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.
  • I Offline
    I Offline
    IamAmit
    wrote on last edited by
    #1

    Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks

    S S D 3 Replies Last reply
    0
    • I IamAmit

      Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks

      S Offline
      S Offline
      SeMartens
      wrote on last edited by
      #2

      How did you assigned the value to the textbox control, and most important when (where in your code)? Please provide the snippet of your code where you assign the value to the control.

      It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

      I 1 Reply Last reply
      0
      • S SeMartens

        How did you assigned the value to the textbox control, and most important when (where in your code)? Please provide the snippet of your code where you assign the value to the control.

        It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

        I Offline
        I Offline
        IamAmit
        wrote on last edited by
        #3

        Thanks for reply.. protected void Page_Load(object sender, EventArgs e) { if (Session["test"] == null) { } else { Text1.Value = Convert.ToString(Session["test"]); TextBox1.Text = Convert.ToString(Session["test"]); } } This is how i assigned the values? is there any other way?

        S 1 Reply Last reply
        0
        • I IamAmit

          Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks

          S Offline
          S Offline
          SayreCC
          wrote on last edited by
          #4

          Hi, you can try this in your webform1 session("id")= textbox1.text in your webform2 textbox2.text = session("id") Hope this one can help. Thanks

          I 1 Reply Last reply
          0
          • I IamAmit

            Thanks for reply.. protected void Page_Load(object sender, EventArgs e) { if (Session["test"] == null) { } else { Text1.Value = Convert.ToString(Session["test"]); TextBox1.Text = Convert.ToString(Session["test"]); } } This is how i assigned the values? is there any other way?

            S Offline
            S Offline
            SeMartens
            wrote on last edited by
            #5

            Hmmm, seems quite right to me. Maybe you should check for a postback before:

            protected void Page_Load(object sender, EventArgs e)
            {
            if(!this.IsPostBack)) {
            if (Session["test"] == null)
            { }
            else
            {

                Text1.Value = Convert.ToString(Session\["test"\]);
                TextBox1.Text = Convert.ToString(Session\["test"\]);
             }
            

            }
            }

            It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

            I 1 Reply Last reply
            0
            • I IamAmit

              Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks

              D Offline
              D Offline
              Dev S
              wrote on last edited by
              #6

              Do one thing take the Session value in variable first and then test with break points. I think your if condition is not working correctly.

              I 1 Reply Last reply
              0
              • D Dev S

                Do one thing take the Session value in variable first and then test with break points. I think your if condition is not working correctly.

                I Offline
                I Offline
                IamAmit
                wrote on last edited by
                #7

                Thanks..I debug the code the value is getting assigned to the textbox correctly..but not displaying..may be viewstate is not refreshed. Is there any solution for this?

                D 1 Reply Last reply
                0
                • S SayreCC

                  Hi, you can try this in your webform1 session("id")= textbox1.text in your webform2 textbox2.text = session("id") Hope this one can help. Thanks

                  I Offline
                  I Offline
                  IamAmit
                  wrote on last edited by
                  #8

                  yes i have already written this code. protected void Page_Load(object sender, EventArgs e) { if(!this.IsPostBack)) { if (Session["test"] == null) { } else { Text1.Value = Convert.ToString(Session["test"]); TextBox1.Text = Convert.ToString(Session["test"]); } } } but not working..The value is assigned to the textbox but not displayed until postback occurs.

                  1 Reply Last reply
                  0
                  • S SeMartens

                    Hmmm, seems quite right to me. Maybe you should check for a postback before:

                    protected void Page_Load(object sender, EventArgs e)
                    {
                    if(!this.IsPostBack)) {
                    if (Session["test"] == null)
                    { }
                    else
                    {

                        Text1.Value = Convert.ToString(Session\["test"\]);
                        TextBox1.Text = Convert.ToString(Session\["test"\]);
                     }
                    

                    }
                    }

                    It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

                    I Offline
                    I Offline
                    IamAmit
                    wrote on last edited by
                    #9

                    I tried that also..but not working :(

                    1 Reply Last reply
                    0
                    • I IamAmit

                      Thanks..I debug the code the value is getting assigned to the textbox correctly..but not displaying..may be viewstate is not refreshed. Is there any solution for this?

                      D Offline
                      D Offline
                      Dev S
                      wrote on last edited by
                      #10

                      Amit viewstate or any such thing has no relevance with this. Just put another textbox and try with that as now i cant find anything wrong in it.

                      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