为了账号安全,请及时绑定邮箱和手机立即绑定

ASP.NET中 listiview 里面绑定button 怎么才能触发button的事件?

ASP.NET中 listiview 里面绑定button 怎么才能触发button的事件?

心有法竹 2018-09-18 08:09:36
<asp:ListView runat="server">        <ItemTemplate>            <table border="0" cellpadding="0" cellspacing="0">                <tr>                    <td>                        <asp:Button Text="text" runat="server" />                    </td>                    <td>                        <asp:Label Text="text" runat="server" />                    </td>                </tr>            </table>        </ItemTemplate>    </asp:ListView>每次点击button 总是提示“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.”而且 itemcommond事件也没有触发
查看完整描述

2 回答

?
素胚勾勒不出你

TA贡献1827条经验 获得超9个赞

根据提示,说明回发中有HTML字符,需要在当前页的Page属性增加enableEventValidation="false".

查看完整回答
反对 回复 2018-09-25
?
凤凰求蛊

TA贡献1825条经验 获得超4个赞

在<%Page %>中加上EnableEventValidation="false"

如果还不行再增加一个 ValidateRequest="false"属性

主要是防止有HTML标记等恶意代码


查看完整回答
反对 回复 2018-09-25
  • 2 回答
  • 0 关注
  • 1182 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号