初学asp.net遇到问题,求大家帮忙!
我抄书上的asp.net代码,运行时遇到问题:
回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentException: 回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
代码为:
<%@ Page Language="C#" AutoEventWireup="true" %>
<head runat="server">
<title>会员信息</title>
<script runat ="server">
void submit(object sender, EventArgs e)
{
table2.Visible = true;
table2.Rows[0].Cells[0].InnerText = "姓名:" + Name.Value;
table2.Rows[1].Cells[0].InnerText ="性别:" + (Man.Checked ? "男": "女");
table2.Rows[2].Cells[0].InnerText ="年龄:" + Age.Value ;
table2.Rows[3].Cells[0].InnerText ="婚姻状况:" + Select1 .Items[Select1 .SelectedIndex ].Value ;
table2.Rows[4].Cells[0].InnerText = train.Checked ? "参加过培训" : "没有参加过培训";
table2.Rows[5].Cells[0].InnerText =TextArea1 .Value ;
}
</script>
<style type="text/css">
.style2
{
width: 126px;
}
.style4
{
width: 38%;
}
.style6
{
width: 128px;
}
.style7
{
height: 70px;
}
.style8
{
width: 190px;
}
.style9
{
width: 617px;
}
</style>
</head>
<body>
<form id="form1" method ="post" runat="server">
<div>
会员信息:</div>
</form>
<table class="style4">
<tr>
<td class="style8">
姓名:</td>
<td class="style2">
<input id="Name" type="text" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
性别:</td>
<td class="style2">
<input id="Man" checked="true" name="sex" type="radio" value="V1" runat ="server" />男
<input id="Woman" name="sex" type="radio" value="V1" runat ="server" />女</td>
</tr>
<tr>
<td class="style8">
年龄:</td>
<td class="style2">
<input id="Age" type="text" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
婚姻状况:</td>
<td class="style2">
<select id="Select1" class="style6" name="D1" runat ="server">
<option value ="已婚">已婚</option>
<option value="未婚">未婚</option>
</select></td>
</tr>
<tr>
<td class="style8">
是否参加过培训:</td>
<td class="style2">
<input id="train" type="checkbox" checked="checked" runat ="server" /></td>
</tr>
<tr>
<td class="style8">
自我介绍:</td>
<td class="style2">
<textarea id="TextArea1" class="style7" cols="20" rows ="4" name="S1" runat ="server"></textarea></td>
</tr>
<tr>
<td class="style8">
<input id="Button1" type="button" value="提交" runat ="server" onserverclick = "submit" /></td>
<td class="style2">
<input id="Reset1" type="reset" value="取消" runat="server" /></td>
</tr>
</table>
<p>
</p>
<table id="table2" visible ="true" cellpadding ="5" cellspacing ="0" border ="2" runat ="server" style="width:30%;">
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
<tr>
<td class="style9">
</td>
</tr>
</table>
</body>
</html>
如果用enableEventValidation="fase",就看不到返回信息了.有没有什么解决的方法啊?