不添加listbox是不会出问题,添加了就出问题.
<html><title>没有</title>
<body>
<form runat="server" >
姓名<asp:TextBox ID="named" runat="server" BorderWidth="1" /> <br>
兴趣<asp:TextBox ID="xingqu" runat="server" BorderWidth="1" /> <br>
<p><asp:ListBox runat="server" ID="city" Rows="2">
<asp:ListItem >广东</asp:ListItem>
<asp:ListItem Selected="true">湖南</asp:ListItem>
<asp:ListItem>福建</asp:ListItem>
<asp:ListItem>山东</asp:ListItem>
</asp:ListBox>
<asp:Button runat="server" Text="提交" OnClick="button_click"/></p>
</form>
</body>
</html>
<script language="vb" runat="server">
sub button_click(a as object,e as eventargs)
dim url,cityurl,i
url="test1.aspx?named=" & named.text
url &= "&xingqu=" & xingqu.text
for i=0 to city.items.count-1
if city.items(i).selected then
cityurl &= city.items(i).text & "<br>"
end if
next
url &= "&city=" & cityurl
server.Transfer(url)
end sub
</script>
然后我在test1.aspx中<%named=request("named")
xingqu=request("xingqu")
city=request("city")
response.write(named & city & "你的兴趣是" &xingqu) %>
就出现如下错误:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
[此贴子已经被作者于2006-9-24 14:08:54编辑过]