转发器内部复选框的OnCheckedChanged事件 [英] OnCheckedChanged Event for the checkbox inside the repeater

查看:125
本文介绍了转发器内部复选框的OnCheckedChanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试使用转发器内的复选框控件.
在此复选框控件上,我试图调用服务器端事件以进行验证.

但是,尽管我使用了OnCheckedChanged事件,但呼叫不会转到服务器.

我可以使用onClick事件来获取客户端函数调用,但是服务器端事件无法正常工作.

请帮帮我.

请回复我的个人ID:[已删除] @ gmail.com.

等待你的间谍.

谢谢
Bhavin Shah.

[修改:您无需提供电子邮件地址.收到答案后,它将转到您提供给CP的电子邮件地址.]

Hi,

I am trying to use the checkbox control inside the repeater.
On this checkbox control, i am trying to call server side event for validation purpose.

but the call does not go to the server though i have used OnCheckedChanged Event.

I am able to get the client side function call using onClick Event, but server side event is not working.

please help me out.

please reply on my personal id:[removed]@gmail.com.

Waiting for your repy.

Thanking You,
Bhavin Shah.

[Modified: you do not need to provide your email address. When you receive an answer, it will go to the email address you provided to CP.]

推荐答案



请尝试以下操作:

Hi,

Try the following:

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" >
       <ItemTemplate>
       <asp:CheckBox ID="chk" runat="server" AutoPostBack="true" Text='<%#Bind("CustomerName")%>' OnCheckedChanged="check_changed"/>
       </ItemTemplate>
       </asp:Repeater>







protected void check_changed(object sender, EventArgs e)
    {
        if (sender != null)
        {
            try
            {
                if (((CheckBox)sender).Checked)
                {
                    Response.Write(((CheckBox)sender).Text + " is checked");
                }
            }
            catch { }
        }
    }




希望这会起作用.干杯:thumbsup:




Hope this will work. Cheers :thumbsup:


这篇关于转发器内部复选框的OnCheckedChanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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