page1.aspx,
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="javascript"> function CopyTextToHiddenField() { var textbox1Value = document.getElementById("<%=TextBox1.ClientID%>").value; document.forms[1].document.getElementById("Hidden1").value = textbox1Value; } </script> </head> <body> <form id="form1" runat="server"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </form> <form name="SubmittedForm" action="page2.aspx" method="post"> <input id="Submit1" type="submit" value="submit" onclick="CopyTextToHiddenField()" /> <input name="Hidden1" type="hidden" /> </form> </body> </html>
page2.aspx,
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { Response.Write(Request.Form["Hidden1"]); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html>
Related posts:
0 comments:
Post a Comment
Your comments: