<asp:Repeater ID="RepNews" runat="server" onitemcommand="RepNews_ItemCommand">
                    <HeaderTemplate>
                        <table>
                            <tr>
                                  <td id="TD_ZHtitle" runat="server">
                                    中文
                                </td>
我想在后台用代码控制它的显示;可是读不到ZHtitle!!!!是不是它在Repeater 控件里面啊!!!!要怎么解决啊

解决方案 »

  1.   

    要写在Repeater 绑定事件里面。后台不能直接拿TD_ZHtitle
      

  2.   

     <table>
            <asp:Repeater ID="Repeater1" runat="server">
                <HeaderTemplate>
                    <tr>
                        <td>
                            第一列
                        </td>
                    </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                         <td>
                            <%#Eval("数据列") %>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </table>
      

  3.   

    用js控制!  <td id="td1" style="display:none"><script>
    document.getElementById("td1").style.display = "block";
    </script>
      

  4.   

    只要循环行就行了table标签放外面
      

  5.   

    代码我只贴出一点点来啦!主要是想让大家看一下怎么后台获得前台的那个格格标签啊                <asp:Repeater ID="RepNews" runat="server" onitemcommand="RepNews_ItemCommand">
                        <HeaderTemplate>
                            <table id="MenuTable" runat="server" class="main_table" cellpadding="0" cellspacing="1" border="0"
                                width="100%">
                                <tr runat="server" align="center" class="td_title">
                                    <td style="height: 10px;" class="usertablerow1" align="center" width="8%">
                                        全选<input id="Checkbox2" type="checkbox" runat="server" onclick="selectAll('MenuTable',this.checked)" />
                                    </td>
                                    <td class="usertablerow1" width="3%" style="height: 7px;" align="center">
                                        级数
                                    </td>
                                    <td id="TD_ZHtitle" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        中文
                                    </td>
                                    <td id="TD_ENtitle"  runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        英文
                                    </td>
                                    <td id="TD_EStitle"  runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        西班牙
                                    </td>
                                    <td id="TD_FRtitle" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        法语
                                    </td>
                                    <td id="TD_RUtitle" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        俄语
                                    </td>
                                    <td id="TD_ARtitle" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        阿拉伯语
                                    </td>
                                    <td id="TD_JPtitle"  runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        日语
                                    </td>
                                    <td id="TD_KRtitle"  runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        韩语
                                    </td>
                                    <td  class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                        排序
                                    </td>
                                    <td class="usertablerow1" width="35%" style="height: 7px;" align="center">
                                        &nbsp; 操作
                                    </td>
                                </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr class="td_on" onmouseover="this.className='td_off'" onmouseout="this.className='td_on'">
                                <td class="usertablerow1" align="center" width="8%" style="height: 7px;">
                                    <asp:CheckBox ID="chkSelect" runat="server" /><asp:Label ID="Label1" runat="server"
                                        Text='<%#DataBinder.Eval(Container.DataItem, "Id")%>' Visible="false"></asp:Label>
                                </td>
                                <td runat="server" class="usertablerow1" width="3%" style="height: 7px;" align="center">
                                    <%# Eval("Depth") %>
                                </td>
                                <td id="TD_ZH" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeZH")%>
                                </td>
                                <td id="TD_EN" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeEN")%>
                                </td>
                                <td id="TD_ES"  runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeES")%>
                                </td>
                                <td id="TD_FR" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeFR")%>
                                </td>
                                <td id="TD_RU" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeRU")%>
                                </td>
                                <td  id="TD_AR" runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeAR")%>
                                </td>
                                <td id="TD_JP"  runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeJP")%>
                                </td>
                                <td id="TD_KR"  runat="server" class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <%#Eval("ProTypeKR")%>
                                </td>
                                 <td class="usertablerow1" width="8%" style="height: 7px;" align="center">
                                    <asp:ImageButton ID="ImageButton1" runat="server" CommandName="up" CommandArgument='<%# Eval("PSort") %>' ImageUrl="~/Admin/images/Rup.jpg"/><asp:ImageButton ID="ImageButton2" CommandName="down" CommandArgument='<%# Eval("PSort") %>' runat="server" ImageUrl="~/Admin/images/Rdown.jpg"/>
                                </td>
                                <td class="usertablerow1" width="35%" style="height: 7px;" align="center">
                                    <a onclick='javascript:window.open ("DetailProductType.aspx?id=<%#Eval("Id")%>&Type=Edit", "newwindow","height=400, width=480, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");' style="cursor:hand">编辑</a>|<a href="ProductType.aspx?id=<%#Eval("Id") %>">查看下级</a>|<a onclick='javascript:window.open ("DetailProductType.aspx?id=<%#Eval("Id")%>&Type=Add", "newwindow","height=400, width=480, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");' style="cursor:hand">增加下级</a>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
      

  6.   

    如果是在HeaderTemplate中,那么就可以直接写死,
    或者你也可以直接将这部分要表达的数据放在repeater外面
    因为repeater是原样显示的
    所以哪怕你只在repeater的ItemTemplate中写<TR><TD></TD></TR>标签,编译后仍然是没有问题的
    你要绑定的数据直接就在ItemTempalte用Eval()进行绑定就OK了
    当然
    如果你讲表格的头子写在repeater外面,结束部分写在FootTemplate中或者repeater下面也是没有问题的
      

  7.   

    后台可以通过findcontrol来找到前面的控件,直接取ID是取不到的
      

  8.   

    HtmlTableCell htc = (HtmlTableCell)RepNews.item[""].FindControl("ControlID")
      

  9.   

    那个应该可以控制,页面中<tr runat=server id = "t_Seq">然后在后台代码中定义
    public bool ShowSeq
        {
            set { this.t_Seq.Visible = value; }
        }
      

  10.   

    与Repeater有关我也曾遇到过这类问题,这理解的还行http://blog.csdn.net/BossDarcy/archive/2010/12/01/6047586.aspx
      

  11.   

     <td id="TD_ZHtitle" runat="server">
    中文
    </td>
    ---------------这个地方改成<asp:Literal id="lit1"控件
    在repeater   onitemdatabound事件里面根据 程序判断
    如果可以显示,获取findcontrol(“lit1”) 然后lit1.Text="<td>中文</td>";
      

  12.   

    你神经病,脑子进水啊,你<td id="TD_ZHtitle" runat="server"></td>什么意思,不是我想骂你,是我真的想骂你。乱来的家伙,还跑到我空间去训我!......