situations arise when we need to post data from our form to other asp,jsp pages...
we need to handle this situation differently
i have added a sample code which takes the value for the TextBox and it will transfer the datas to a different page where the data from the TextBox will be processed.
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Write("<html><head>");
System.Web.HttpContext.Current.Response.Write("</head><body onload=\"document.Form1.submit()\">");
//transfer the control to http://mysite/WebForm2.aspx
System.Web.HttpContext.Current.Response.Write("<form name=\"Form1\" method=\"post\" action=\"http://localhost/ee/WebForm2.aspx\" >");
//add the value of the text box to a hidden control
System.Web.HttpContext.Current.Response.Write("<input name=\"txtname\" type=\"hidden\" value=\"" + TextBox1.Text + "\">");
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body></html>");
System.Web.HttpContext.Current.Response.End();
No comments:
Post a Comment