为什么我从页面发布到页面时我的Asp.Net表单为空? [英] Why is my Asp.Net Form arriving empty when I post from Page to Page?
本文介绍了为什么我从页面发布到页面时我的Asp.Net表单为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下HTML代码
<%@ Page Language="C#" %>
<html>
<head>
<title></title>
</head>
<body>
<form id="frmSystem" method="post" action="target.aspx">
<input id="txtTextField" type="text" />
<input id="btnPost" value="Submit" onclick="javascript:frmSystem.submit();" type="button" />
</form>
</body>
</html>
目标页面即将出现,但接收的表单为空.我在target.aspx页面上有一个断点,虽然可以看到一个表单,但是它的键是空的,而Request ["txtTextField"]却什么也没给我.
The target Page is coming up but the form that it is receiving is empty. I have a break point on my target.aspx page and while I can see a form, it's keys are empty and Request["txtTextField"] gives me nothing.
有什么线索吗?
推荐答案
如果使用的是ASP.NET MVC,则需要使用名称"属性而不是"id"设置输入名称.
If you are using ASP.NET MVC, the input names need to be set with the "name" attribute rather than "id".
这篇关于为什么我从页面发布到页面时我的Asp.Net表单为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文