How to submit a page on the popup page?

SheoNarayan
Posted by SheoNarayan under ASP.NET category on | Points: 40 | Views : 3288
In order to post the current page on the popup page, following code snippet can be written.

<input type="button" value="Post On Another Page" onclick="PostForm()" />

<script language="javascript" type="text/javascript">
function PostForm(id)
{
var form = document.forms[0];
form.action = "AnotherPage.aspx; // popup page url
form.target = "_blank"; //open in another window
form.submit();

form.action = "currentpage.aspx"; // url of the current page
form.target = ""; // remove the target you had specified
}
</script>


On the AnotherPage.aspx, write following code snippet in the Page Load to get the values of the control placed on the currentpage.aspx

foreach (string key in Request.Form.Keys)
{
if (key.Contains("yourtextboxid"))
{
string myTextBoxValue = Request.Form[key];
}
}


Hope this will be helpful.

Comments or Responses

Login to post response