如何在中继器控制中使用按钮? [英] How to use button in repeater control?

查看:115
本文介绍了如何在中继器控制中使用按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c#中使用asp.net 3.5.我想在转发器控件中调用按钮单击事件.

I am using asp.net 3.5 with c#.I want to invoke button click event inside repeater control.

<asp:Repeater ID="rptFriendsList"
    runat="server" 
    onitemcommand="rptFriendsList_ItemCommand">
    <ItemTemplate> 
        <asp:ImageButton ID="btnSave"
                         runat="server" 
                         ImageUrl="~/Contents/Images/save_button.png"
                         CommandName="Schedule"
                         UseSubmitBehavior="False"  />
    </ItemTemplate>
</asp:Repeater>

但是当我单击按钮时出现错误

but when i click to a button its giving an error

无效的回发或回调争论.事件验证已启用用在配置或<%@页面EnableEventValidation ="true"%>在页.为了安全起见,这是功能验证该参数是否回发或回调事件起源从服务器控制最初渲染它们.如果数据有效且预期有效,请使用ClientScriptManager.RegisterForEventValidation方法来注册的回传或回调数据验证."

"Invalid postback or callback argument. Event validation is enabled using 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."

我的目的是在放置在转发器内部的按钮单击中执行一些代码.请帮助我解决此问题.

my purpose is to execute some code in button click which is placed inside the repeater.Please help me to solve this issue.Thanks in advance.

推荐答案

UseSubmitBehavior ="False" 您使用过的此属性不随图像按钮一起出现,让您覆盖了imagebutton类并添加了此按钮属性.

UseSubmitBehavior="False" this property you have used is not present with the image button have you over ridden imagebutton class and added this property.

这篇关于如何在中继器控制中使用按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆