<asp:Repeater ID="RepNews" runat="server" onitemcommand="RepNews_ItemCommand">
<HeaderTemplate>
<table>
<tr>
<td id="TD_ZHtitle" runat="server">
中文
</td>我想在后台用代码控制它的显示;可是读不到ZHtitle!!!!是不是它在Repeater 控件里面啊!!!!要怎么解决啊
<HeaderTemplate>
<table>
<tr>
<td id="TD_ZHtitle" runat="server">
中文
</td>我想在后台用代码控制它的显示;可是读不到ZHtitle!!!!是不是它在Repeater 控件里面啊!!!!要怎么解决啊
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<tr>
<td>
第一列
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%#Eval("数据列") %>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
document.getElementById("td1").style.display = "block";
</script>
<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">
操作
</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>
或者你也可以直接将这部分要表达的数据放在repeater外面
因为repeater是原样显示的
所以哪怕你只在repeater的ItemTemplate中写<TR><TD></TD></TR>标签,编译后仍然是没有问题的
你要绑定的数据直接就在ItemTempalte用Eval()进行绑定就OK了
当然
如果你讲表格的头子写在repeater外面,结束部分写在FootTemplate中或者repeater下面也是没有问题的
public bool ShowSeq
{
set { this.t_Seq.Visible = value; }
}
中文
</td>
---------------这个地方改成<asp:Literal id="lit1"控件
在repeater onitemdatabound事件里面根据 程序判断
如果可以显示,获取findcontrol(“lit1”) 然后lit1.Text="<td>中文</td>";