一个简单的问题!在线等!解决马上给分

WJY258378040 2010-12-03 04:17:47
<asp:Repeater ID="RepNews" runat="server" onitemcommand="RepNews_ItemCommand">
<HeaderTemplate>
<table>
<tr>
<td id="TD_ZHtitle" runat="server">
中文
</td>




我想在后台用代码控制它的显示;可是读不到ZHtitle!!!!是不是它在Repeater 控件里面啊!!!!

要怎么解决啊
...全文
144 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
吴青峰 2010-12-04
  • 打赏
  • 举报
回复
你在问这些不沾边的问题,今后你上门都没人要!
吴青峰 2010-12-04
  • 打赏
  • 举报
回复
你神经病,脑子进水啊,你<td id="TD_ZHtitle" runat="server"></td>什么意思,不是我想骂你,是我真的想骂你。乱来的家伙,还跑到我空间去训我!......
xieliliang 2010-12-04
  • 打赏
  • 举报
回复
<td id="TD_ZHtitle" runat="server">
中文
</td>
---------------这个地方改成<asp:Literal id="lit1"控件
在repeater onitemdatabound事件里面根据 程序判断
如果可以显示,获取findcontrol(“lit1”) 然后lit1.Text="<td>中文</td>";
技术小黑屋 2010-12-03
  • 打赏
  • 举报
回复
与Repeater有关我也曾遇到过这类问题,这理解的还行http://blog.csdn.net/BossDarcy/archive/2010/12/01/6047586.aspx
java__net 2010-12-03
  • 打赏
  • 举报
回复
那个应该可以控制,页面中<tr runat=server id = "t_Seq">

然后在后台代码中定义
public bool ShowSeq
{
set { this.t_Seq.Visible = value; }
}
linsx1987 2010-12-03
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 zp19900704 的回复:]

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

+1
zp19900704 2010-12-03
  • 打赏
  • 举报
回复
HtmlTableCell htc = (HtmlTableCell)RepNews.item[""].FindControl("ControlID")
天下在我心 2010-12-03
  • 打赏
  • 举报
回复
后台可以通过findcontrol来找到前面的控件,直接取ID是取不到的
chen_ya_ping 2010-12-03
  • 打赏
  • 举报
回复
[Quote=引用楼主 wjy258378040 的回复:]
<asp:Repeater ID="RepNews" runat="server" onitemcommand="RepNews_ItemCommand">
<HeaderTemplate>
<table>
<tr>
……
[/Quote]
对的,其实显不显示可以通过前台绑定后天的数据,用3元运算符来搞定。
qjmay860909 2010-12-03
  • 打赏
  • 举报
回复
如果是在HeaderTemplate中,那么就可以直接写死,
或者你也可以直接将这部分要表达的数据放在repeater外面
因为repeater是原样显示的
所以哪怕你只在repeater的ItemTemplate中写<TR><TD></TD></TR>标签,编译后仍然是没有问题的
你要绑定的数据直接就在ItemTempalte用Eval()进行绑定就OK了
当然
如果你讲表格的头子写在repeater外面,结束部分写在FootTemplate中或者repeater下面也是没有问题的
WJY258378040 2010-12-03
  • 打赏
  • 举报
回复
代码我只贴出一点点来啦!主要是想让大家看一下怎么后台获得前台的那个格格标签啊

<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">
  操作
</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>
porschev 2010-12-03
  • 打赏
  • 举报
回复
只要循环行就行了。。。table标签放外面
#blackheart 2010-12-03
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 xiaoxi228 的回复:]

<table>
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<tr>
<td>
第一列
</td>
……
[/Quote]
+1
一克代码 2010-12-03
  • 打赏
  • 举报
回复
用js控制!

<td id="td1" style="display:none">

<script>
document.getElementById("td1").style.display = "block";
</script>
骚飞飞 2010-12-03
  • 打赏
  • 举报
回复
<table>
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<tr>
<td>
第一列
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%#Eval("数据列") %>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
yan267 2010-12-03
  • 打赏
  • 举报
回复
要写在Repeater 绑定事件里面。后台不能直接拿TD_ZHtitle
一切为了你 2010-12-03
  • 打赏
  • 举报
回复
用asp.net 控件试试
骚飞飞 2010-12-03
  • 打赏
  • 举报
回复
汗 不能这么写哦!

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧