在按钮单击事件上选中或不选中“重复器”复选框 [英] Repeater checkbox is checked or not on button click event

查看:92
本文介绍了在按钮单击事件上选中或不选中“重复器”复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须执行,按钮点击event.checkbox上的复选框检查事件在repeater.i将执行以下代码,但它给出错误。(对象引用未设置对象的实例)



我尝试过:



i have to perform, checkbox checked event on button click event.checkbox is on repeater.i will do following code but it gives error.(object reference not set instans of object)

What I have tried:

protected void btnsave_Click(object sender, EventArgs e)
    {
        foreach (RepeaterItem item in rptr.Items)
        {
            if (((CheckBox)item.FindControl("Checkbox1")).Checked)
            {
                
            }
        }
    }

推荐答案

没有人看到并运行你的整个代码,没有人可以回答这个问题,使用调试器并检查va线上变量的lue无法看到哪些是null然后解决原因。
No one can answer this question without seeing and running your whole code, use the debugger and check the value of the variables on the line that fails to see which of them is null then solve the reason why.


这篇关于在按钮单击事件上选中或不选中“重复器”复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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