标题:关于listbox问题.
只看楼主
icobio
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2006-9-10
 问题点数:0 回复次数:2 
关于listbox问题.

不添加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编辑过]

搜索更多相关主题的帖子: listbox 
2006-09-24 14:07
chenjin145
Rank: 1
等 级:禁止访问
帖 子:3922
专家分:0
注 册:2006-7-12
得分:0 
<%@ Page EnableEventValidation="true" %>

這個加到頁面上

[url=javascript:alert(1);] [div]fdgfdgfdg\" on\"[/div] [/url]
2006-09-24 15:21
icobio
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2006-9-10
得分:0 

<%@ Page EnableEventValidation="true" %>

上面那句话是什么意思?


cityurl &= city.items(i).text & "<br>" ,我发现错误在"<br>"这里.书上的有错误

2006-09-24 18:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-92620-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018158 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved