reapter中FindControl的用法

来源:互联网 发布:外星生物知乎 编辑:程序博客网 时间:2024/06/06 07:38

在ItemDataBound中写。

要找reapter上的控件:就必须得循环reapter上的控件,找出你所要的控件,这不就得了吗!

代码如下:

              for (int i = 0; i < RptLogs.Items.Count;i++)
                {
                    Label l = (Label)this.RptLogs.Items[i].FindControl("Label2");
                    Button b = (Button)this.RptLogs.Items[i].FindControl("Btndelete");
                    l.Visible = false;
                    b.Visible = false;

                }

这样就把你所要隐藏的控件要隐藏啦!

原创粉丝点击