Please visit my new Web Site WWW.Codedisplay.com
In most of the cases developers need to pass more than one or multiple query string value from one page to another page. Here in this example i will show you how one can pass multiple values from one page to another page in an efficient way. Let I have a product row and want to send product data from one page to another page so the code will looks like:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sName = "Tibbet"; string sBrand = "Kohinoor"; string sDescription = "For menz only"; Response.Redirect(string.Format("Default.aspx?qs1={0}&qs2={1}&qs3={2}", sName, sBrand, sDescription)); } }From second page we can read the value like:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if ((Request.QueryString["qs1"] != null && Request.QueryString["qs2"] != null) && Request.QueryString["qs3"] != null) { string sName = Request.QueryString["qs1"]; string sBrand = Request.QueryString["qs2"]; string sDescription = Request.QueryString["qs3"]; Response.Write(sName+"</br>"); Response.Write(sBrand + "</br>"); Response.Write(sDescription); } } }
Further Reading:
Ways to Pass data from one page to another page
0 comments:
I WOULD BE DELIGHTED TO HEAR FROM YOU