[英]ASP.NET Getting a blank page after submitting a form (beginner)
I am trying to make some game, I'm not going to explain what is it because it's not really important, anyway, the problem is the following form: 我正在尝试制作一些游戏,我不打算解释它是什么,因为它并不重要,无论如何,问题是以下形式:
http://pastebin.com/8XwdDFWY http://pastebin.com/8XwdDFWY
after submitting that form I'm getting a blank page. 提交该表格后,我得到一个空白页面。
Here's the server side code which that form navigates to: 这是表单导航到的服务器端代码:
http://pastebin.com/tfeAMxrF http://pastebin.com/tfeAMxrF
Thank for helpers! 谢谢佣工!
To backup Aristos answer IsPostBack only works when you submit to the same page. 备份Aristos答案IsPostBack仅在您提交到同一页面时有效。 You are cross page scripting therefore it's not a postback but a new request.
您是跨页面脚本,因此它不是回发而是新请求。
The issue is that you use the IsPostBack that is stop from showing the data after the post back. 问题是您使用IsPostBack停止在回发后显示数据。 Ether remove it, ether use asp.net controls that "remembers *" the content after the post back.
以太网删除它,以太网使用asp.net控件在回发后“记住*”内容。
<%
// this part is blocked as it is, after the post back
if (Page.IsPostBack)
{
int n = int.Parse(Request.Params["number"]);
string name = Request.Params["fname"];
int points = CalcPoints(name, n);
%>
Hello <%=name%> You have chosen number <%=n%>
The random numbers are : <%=num1 + " , " + num2 + " , " + num3%>
You have scored <%=points%> points!
<%
}
%>
[*] they saved into the view state [*]他们保存到视图状态
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.