<%@ Page Language="C#" %> <html> <head> <title>Said</title> </head> <body> <form id="form" runat="server"> <% if (!IsPostBack) { %> <input name="foo" /> <input type="submit" /> <% } else if (Request.Form["foo"] != null) { Session["foo"] = Request.Form["foo"]; %> <a href="javascript:form.submit()">click here</a> <% } else { %> you said: <%=Session["foo"]%> <% } %> </form> </body> </html>
<%@ Page Language="C#" %> <form id="f" runat="server"> <% var v = Request.Form["x"]; if (!IsPostBack) { %> <input name="x" /><input type="submit" /> <% } else if (v != null) { Session["x"] = v; %> <a href="javascript:f.submit()">click here</a> <% } else { %>you said: <%=Session["x"]%><% } %></form>
-----