<FooterTemplate>
            <tr>
              <td colspan="7"><asp:Label ID="labpage" runat="server" Text=""></asp:Label>
                
                共
                <%=i %>
                条
              </td>
            </tr>          
          </FooterTemplate>
 Label lab = (Label)this.Repeater1.FindControl("labpage");
就是取不到这相 lab 为什么

解决方案 »

  1.   

    其实labpage是在Footer下,不在Repeater下
      

  2.   

    你在后台还用这样 ??
    直接在cs中this.labpage.text= 
      

  3.   

    this.labpage.text=
    访问不对,提示上下文找不到  .
      

  4.   

    解决了:
    Label lab = (Label)Repeater1.Controls[Repeater1.Controls.Count - 1].FindControl("labpage");Footertemplate在整个Repeater的Controls集合中是最后一个,因此访问它的途径之一是这样的:
        rpt是一个Repeater对象
        Control ctl = rpt.Controls[rpt.Controls.Count-1];
        之后如果需要访问Footertemplate中的控件,则只需调用ctl的findcontrol方法即可。    需要注意的是,采用上述方法访问Footertemplate控件,必须在repeater进行databind之后,否则会出现null引用的错误。
      

  5.   

    试试:
      for(int i=0;i<repeater1.Items.Count;i++)
      {
        Label myL=(Label)repeater1.Items[i].FindControl("labpage");
           myL.Text=".....";
           ...........
      }