Following sample explains how to post form and data and retrieve it.
-------------------------------------------------------------------
FORM A
<form id="form_1" name="Email" action="FORMB.aspx" accept-charset="UTF-8" method="post" target="_self" enctype="application/x-www-form-urlencoded" style="margin:0px;">
<a name="edit_1"
<input type="text" id="edit_1" name="NAME" maxlength="50" value="" >
<input type="submit" style="position:absolute; left:194px; top:490px; width:81px; height:22px;" id="butn_1" value="Submit">
</form>
-------------------------------------------------------------------
FORM B
codebegind of JumpToMe.aspx
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
NameValueCollection coll = Request.Form;
string sName = "";
foreach (string key in coll.AllKeys)
{
//Response.Write("Key - " + key);
//Response.Write("Value - " + coll[key]);
//Response.Write("---");
if (key == "NAME")
sName = coll[key];
...
...
...
}
...
...
...
}
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
-------------------------------------------------------------------
FORM A
<form id="form_1" name="Email" action="FORMB.aspx" accept-charset="UTF-8" method="post" target="_self" enctype="application/x-www-form-urlencoded" style="margin:0px;">
<a name="edit_1"
<input type="text" id="edit_1" name="NAME" maxlength="50" value="" >
<input type="submit" style="position:absolute; left:194px; top:490px; width:81px; height:22px;" id="butn_1" value="Submit">
</form>
-------------------------------------------------------------------
FORM B
codebegind of JumpToMe.aspx
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
NameValueCollection coll = Request.Form;
string sName = "";
foreach (string key in coll.AllKeys)
{
//Response.Write("Key - " + key);
//Response.Write("Value - " + coll[key]);
//Response.Write("---");
if (key == "NAME")
sName = coll[key];
...
...
...
}
...
...
...
}
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
No comments:
Post a Comment