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. query string

query string

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelptutorial
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.
  • J Offline
    J Offline
    jai 123
    wrote on last edited by
    #1

    hi, Using querys string how to pass the textbox value from one page to another page in asp.net I tryed this coding but it is not working In first page Response.Redirect("WebForm2.aspx? name="+this.txtname.Text+" & city="+this.txtcity.Text); In next page this.txtname1.Text=Request.QueryString["name"]; this.txtcity1.Text=Request.QueryString["city"]; plese help me

    jai prakash

    T I G 3 Replies Last reply
    0
    • J jai 123

      hi, Using querys string how to pass the textbox value from one page to another page in asp.net I tryed this coding but it is not working In first page Response.Redirect("WebForm2.aspx? name="+this.txtname.Text+" & city="+this.txtcity.Text); In next page this.txtname1.Text=Request.QueryString["name"]; this.txtcity1.Text=Request.QueryString["city"]; plese help me

      jai prakash

      T Offline
      T Offline
      Talal Sultan
      wrote on last edited by
      #2

      The code you wrote has some spaces in it. Are you getting an error or just not getting the values? Did you debug to check if the Text properties hold some values? where are you placing the code to retrieve the querystring elements? Is it on a postback or on first post? Talal

      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

      1 Reply Last reply
      0
      • J jai 123

        hi, Using querys string how to pass the textbox value from one page to another page in asp.net I tryed this coding but it is not working In first page Response.Redirect("WebForm2.aspx? name="+this.txtname.Text+" & city="+this.txtcity.Text); In next page this.txtname1.Text=Request.QueryString["name"]; this.txtcity1.Text=Request.QueryString["city"]; plese help me

        jai prakash

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #3

        Try this code Response.Redirect("WebForm2.aspx? name="+Server.UrlEncode(this.txtname.Text)+" & city="+Server.UrlEncodethis.txtcity.Text)); this.txtname1.Text=Server.UrlDecodeRequest.QueryString["name"].ToString()); this.txtcity1.Text=Server.UrlDecode(Request.QueryString["city"].ToString()); Best Regard Pathan

        ---------------------------------------------------

        G J 2 Replies Last reply
        0
        • J jai 123

          hi, Using querys string how to pass the textbox value from one page to another page in asp.net I tryed this coding but it is not working In first page Response.Redirect("WebForm2.aspx? name="+this.txtname.Text+" & city="+this.txtcity.Text); In next page this.txtname1.Text=Request.QueryString["name"]; this.txtcity1.Text=Request.QueryString["city"]; plese help me

          jai prakash

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          You have spaces in the url, which should not be there. Also, you need to url-encode the values to be able to handle more than the most simple values. Response.Redirect("WebForm2.aspx?name=" + Server.UrlEncode(this.txtname.Text) + "&city=" + Server.UrlEncode(this.txtcity.Text));

          --- single minded; short sighted; long gone;

          J 1 Reply Last reply
          0
          • I Imran Khan Pathan

            Try this code Response.Redirect("WebForm2.aspx? name="+Server.UrlEncode(this.txtname.Text)+" & city="+Server.UrlEncodethis.txtcity.Text)); this.txtname1.Text=Server.UrlDecodeRequest.QueryString["name"].ToString()); this.txtcity1.Text=Server.UrlDecode(Request.QueryString["city"].ToString()); Best Regard Pathan

            ---------------------------------------------------

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            Imran Khan Pathan wrote:

            Try this code Response.Redirect("WebForm2.aspx? name="+Server.UrlEncode(this.txtname.Text)+" & city="+Server.UrlEncodethis.txtcity.Text));

            But without the spaces.

            Imran Khan Pathan wrote:

            this.txtname1.Text=Server.UrlDecodeRequest.QueryString["name"].ToString()); this.txtcity1.Text=Server.UrlDecode(Request.QueryString["city"].ToString());

            You don't decode the values from Request.QueryString. that is done automatically. Also, you don't need to use ToString to convert a string from a string to a string. this.txtname1.Text = Request.QueryString["name"]; this.txtcity1.Text = Request.QueryString["city"];

            --- single minded; short sighted; long gone;

            1 Reply Last reply
            0
            • I Imran Khan Pathan

              Try this code Response.Redirect("WebForm2.aspx? name="+Server.UrlEncode(this.txtname.Text)+" & city="+Server.UrlEncodethis.txtcity.Text)); this.txtname1.Text=Server.UrlDecodeRequest.QueryString["name"].ToString()); this.txtcity1.Text=Server.UrlDecode(Request.QueryString["city"].ToString()); Best Regard Pathan

              ---------------------------------------------------

              J Offline
              J Offline
              jai 123
              wrote on last edited by
              #6

              Dear pathan, Response.Redirect("querystring1.aspx? name="+Server.UrlEncode(this.txtname.Text)+" & city="+Server.UrlEncode(this.txtcity.Text)); this.txtname1.Text=Server.UrlDecode(Request.QueryString["name"].ToString()); this.txtcity1.Text=Server.UrlDecode(Request.QueryString["city"].ToString()); I tryed the code,but following error is comming."Object reference not set to an instance of an object".

              jai prakash

              G 1 Reply Last reply
              0
              • G Guffa

                You have spaces in the url, which should not be there. Also, you need to url-encode the values to be able to handle more than the most simple values. Response.Redirect("WebForm2.aspx?name=" + Server.UrlEncode(this.txtname.Text) + "&city=" + Server.UrlEncode(this.txtcity.Text));

                --- single minded; short sighted; long gone;

                J Offline
                J Offline
                jai 123
                wrote on last edited by
                #7

                hi Guffa, Thanks I got the answer.

                jai prakash

                J 1 Reply Last reply
                0
                • J jai 123

                  hi Guffa, Thanks I got the answer.

                  jai prakash

                  J Offline
                  J Offline
                  jai 123
                  wrote on last edited by
                  #8

                  hi, Using sessions,how to call the value from one page to another page.

                  jai prakash

                  G 1 Reply Last reply
                  0
                  • J jai 123

                    hi, Using sessions,how to call the value from one page to another page.

                    jai prakash

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #9

                    Using sessions? Do you mean session variables? What do you mean by "call" the value?

                    --- single minded; short sighted; long gone;

                    1 Reply Last reply
                    0
                    • J jai 123

                      Dear pathan, Response.Redirect("querystring1.aspx? name="+Server.UrlEncode(this.txtname.Text)+" & city="+Server.UrlEncode(this.txtcity.Text)); this.txtname1.Text=Server.UrlDecode(Request.QueryString["name"].ToString()); this.txtcity1.Text=Server.UrlDecode(Request.QueryString["city"].ToString()); I tryed the code,but following error is comming."Object reference not set to an instance of an object".

                      jai prakash

                      G Offline
                      G Offline
                      Guffa
                      wrote on last edited by
                      #10

                      That's because there is no item in the Reqeust.QueryString collection with the key "city". Due to your extra spaces the key is " city".

                      --- single minded; short sighted; long gone;

                      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