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