当前位置: 代码迷 >> 外设及办公设备 >> 在Repeater中:解决方案
  详细解决方案

在Repeater中:解决方案

热度:3141   发布时间:2013-02-26 00:00:00.0
在Repeater中:
在Repeater中: 
     <HeaderTemplate> 
     <table cellpadding="0" cellspacing="0" width="850px" style="background-color:#F2F2F3"> 
     <tr style=" height:30px; background-color:#DF1A41"> 
     <td align="left" colspan="6" > 
     <span style="font-weight:bold; color:Black"> 
     『 <asp:Label ID="Label1" runat="server" > </asp:Label>』 </span> </td> 
     </tr> 
     <tr > 
     <td  style="width:5%"> </td> <td align="left" style="width:55%">主题 </td> 
     <td align="left" style="width:10%">作者 </td> 
     <td align="left" style="width:13%">回复/查看 </td> 
     <td align="left" style="width:17%">最后发表 </td> 
     </tr> 
     </HeaderTemplate> 
后台 
  protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!this.IsPostBack) 
        { 
            foreach (RepeaterItem item in this.Repeater.Items) 
            { 
                if (item.ItemType == ListItemType.Header) 
                { 
                    Label lab = (Label)this.Repeater.Controls[0].FindControl("Label1"); 
                    lab.Text = "qq"; 
                } 

            } 
              this.bind(); 
        } 
        
   } 
 private void bind()  
    { 
        string newid = Request.QueryString["id"]; 
        int id = Convert.ToInt32(newid); 
        this.Repeater.DataSource = sp.getds1("getpost",id); 
        this.Repeater.DataBind(); 
    } 
前台Label1还是看不见。 
现在想解决的问题是:怎样在后体取得HeaderTemplate中的label控件,让它能显示,谢谢了。
------解决方案--------------------------------------------------------
????
  相关解决方案