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 values from textboxes on one page to a "another page"

How to pass values from textboxes on one page to a "another page"

Scheduled Pinned Locked Moved ASP.NET
helptutorial
8 Posts 5 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
    megivimal
    wrote on last edited by
    #1

    hi, any one help me, How to pass values from textboxes on one page to a "another page" using session. I have the follwing code but it shows an error msg. public string PassingSession ; Session["strPharmacyId"] = txtPharmacyId.Text.Trim(); Session["strStoreName"] = txtStoreName.Text.Trim(); Session["strAddress1"] = txtAddress.Text.Trim(); Session["strCity"] = txtCity.Text.Trim(); Session["strState"] = txtState.Text.Trim(); PassingSession = PassingSession + Session["strPharmacyId"]; PassingSession = PassingSession + Session["strStoreName"]; PassingSession = PassingSession + Session["strAddress1"]; PassingSession = PassingSession + Session["strCity"]; PassingSession = PassingSession + Session["strState"]; Session["Pharmacy"] = PassingSession; dtSession = (DataTable)Session["Pharmacy"]; msg: "can't convert string to datatable";

    A M B 3 Replies Last reply
    0
    • M megivimal

      hi, any one help me, How to pass values from textboxes on one page to a "another page" using session. I have the follwing code but it shows an error msg. public string PassingSession ; Session["strPharmacyId"] = txtPharmacyId.Text.Trim(); Session["strStoreName"] = txtStoreName.Text.Trim(); Session["strAddress1"] = txtAddress.Text.Trim(); Session["strCity"] = txtCity.Text.Trim(); Session["strState"] = txtState.Text.Trim(); PassingSession = PassingSession + Session["strPharmacyId"]; PassingSession = PassingSession + Session["strStoreName"]; PassingSession = PassingSession + Session["strAddress1"]; PassingSession = PassingSession + Session["strCity"]; PassingSession = PassingSession + Session["strState"]; Session["Pharmacy"] = PassingSession; dtSession = (DataTable)Session["Pharmacy"]; msg: "can't convert string to datatable";

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Vijay.RG wrote:

      dtSession = (DataTable)Session["Pharmacy"];

      What you are doing over here?

      cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net My Latest Article : IIS Remote Debugging

      M 1 Reply Last reply
      0
      • A Abhijit Jana

        Vijay.RG wrote:

        dtSession = (DataTable)Session["Pharmacy"];

        What you are doing over here?

        cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net My Latest Article : IIS Remote Debugging

        M Offline
        M Offline
        megivimal
        wrote on last edited by
        #3

        Passing the session value to datatable object. DataTable dtSession=new DataTable(); dtSession ==> Datatable object.

        A 1 Reply Last reply
        0
        • M megivimal

          hi, any one help me, How to pass values from textboxes on one page to a "another page" using session. I have the follwing code but it shows an error msg. public string PassingSession ; Session["strPharmacyId"] = txtPharmacyId.Text.Trim(); Session["strStoreName"] = txtStoreName.Text.Trim(); Session["strAddress1"] = txtAddress.Text.Trim(); Session["strCity"] = txtCity.Text.Trim(); Session["strState"] = txtState.Text.Trim(); PassingSession = PassingSession + Session["strPharmacyId"]; PassingSession = PassingSession + Session["strStoreName"]; PassingSession = PassingSession + Session["strAddress1"]; PassingSession = PassingSession + Session["strCity"]; PassingSession = PassingSession + Session["strState"]; Session["Pharmacy"] = PassingSession; dtSession = (DataTable)Session["Pharmacy"]; msg: "can't convert string to datatable";

          M Offline
          M Offline
          Manas Bhardwaj
          wrote on last edited by
          #4

          Vijay.RG wrote:

          PassingSession = PassingSession + Session["strPharmacyId"]; PassingSession = PassingSession + Session["strStoreName"]; PassingSession = PassingSession + Session["strAddress1"]; PassingSession = PassingSession + Session["strCity"]; PassingSession = PassingSession + Session["strState"]; Session["Pharmacy"] = PassingSession; dtSession = (DataTable)Session["Pharmacy"];

          You do not this piece of code at all. You already have assigned the textbox values to the Session Objects, the only thing you need to do is to read it back in the next page. In between, your design looks screwed and you should rather reconsider thinking of design before starting coding.

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          M 1 Reply Last reply
          0
          • M Manas Bhardwaj

            Vijay.RG wrote:

            PassingSession = PassingSession + Session["strPharmacyId"]; PassingSession = PassingSession + Session["strStoreName"]; PassingSession = PassingSession + Session["strAddress1"]; PassingSession = PassingSession + Session["strCity"]; PassingSession = PassingSession + Session["strState"]; Session["Pharmacy"] = PassingSession; dtSession = (DataTable)Session["Pharmacy"];

            You do not this piece of code at all. You already have assigned the textbox values to the Session Objects, the only thing you need to do is to read it back in the next page. In between, your design looks screwed and you should rather reconsider thinking of design before starting coding.

            Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

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

            I got the code Mr.Manas Bhardwaj ... Thanks.

            A 1 Reply Last reply
            0
            • M megivimal

              I got the code Mr.Manas Bhardwaj ... Thanks.

              A Offline
              A Offline
              Abhishek Sur
              wrote on last edited by
              #6

              Dont ever store Datatable in Session. It means a huge amount of data will be stored in Session, and for each user who browses the site. So it will eat up all the app pool memory. :sigh:

              Abhishek Sur My Latest Articles Working with Excel using MDAC
              Basics on LINQ and Lambda Expressions
              Create .NET Templates

              1 Reply Last reply
              0
              • M megivimal

                Passing the session value to datatable object. DataTable dtSession=new DataTable(); dtSession ==> Datatable object.

                A Offline
                A Offline
                Abhijit Jana
                wrote on last edited by
                #7

                I think you have already got the answer from Manas Post.

                Vijay.RG wrote:

                Passing the session value to datatable object.

                Never do like that. It will cause very performance issue. :)

                cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net My Latest Article : IIS Remote Debugging

                1 Reply Last reply
                0
                • M megivimal

                  hi, any one help me, How to pass values from textboxes on one page to a "another page" using session. I have the follwing code but it shows an error msg. public string PassingSession ; Session["strPharmacyId"] = txtPharmacyId.Text.Trim(); Session["strStoreName"] = txtStoreName.Text.Trim(); Session["strAddress1"] = txtAddress.Text.Trim(); Session["strCity"] = txtCity.Text.Trim(); Session["strState"] = txtState.Text.Trim(); PassingSession = PassingSession + Session["strPharmacyId"]; PassingSession = PassingSession + Session["strStoreName"]; PassingSession = PassingSession + Session["strAddress1"]; PassingSession = PassingSession + Session["strCity"]; PassingSession = PassingSession + Session["strState"]; Session["Pharmacy"] = PassingSession; dtSession = (DataTable)Session["Pharmacy"]; msg: "can't convert string to datatable";

                  B Offline
                  B Offline
                  Brij
                  wrote on last edited by
                  #8

                  How can you convert a string to datatable because PassingSession is a string as you declared? Here you are assigning values to session

                  Vijay.RG wrote:

                  Session["strPharmacyId"] = txtPharmacyId.Text.Trim(); Session["strStoreName"] = txtStoreName.Text.Trim(); Session["strAddress1"] = txtAddress.Text.Trim(); Session["strCity"] = txtCity.Text.Trim(); Session["strState"] = txtState.Text.Trim();

                  No need of below code

                  Vijay.RG wrote:

                  Session["strState"] = txtState.Text.Trim(); PassingSession = PassingSession + Session["strPharmacyId"]; PassingSession = PassingSession + Session["strStoreName"]; PassingSession = PassingSession + Session["strAddress1"]; PassingSession = PassingSession + Session["strCity"]; PassingSession = PassingSession + Session["strState"]; Session["Pharmacy"] = PassingSession; dtSession = (DataTable)Session["Pharmacy"];

                  You have already filled the textbox value in session.Now it will be accessible throughout ther application.

                  Cheers!! Brij

                  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