Repeater 里放了一个CheckBox和一个Label

sisiz 2008-08-25 11:46:15
Repeater 里放了一个CheckBox和一个Label
程序运行后显示了5个记录
我想CheckBox选择时对应的Label的值,因为他们都在一个行上。

<asp:Repeater ID="rpDicInclude" runat="server">
<HeaderTemplate>
<table width="100"cellpadding="0" cellspacing="0">
</table>
<tr>
<td align="left">
录入选项
</td>
</tr>
<tr>
<td align="left">
<hr color="Gainsboro" size="1" />
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td align="left">
<asp:CheckBox ID="dicInclude" runat="server" Text='<%# Eval("DicInclude") %>' /></td>
</tr>
<tr>
<td align="left">
<asp:Label ID ="IncID" runat="server" Text='<%# Eval("ItemID") %>' /></td>
</tr
<tr>
<td align="left">
<hr color="Gainsboro" size="1" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
...全文
90 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
优途科技 2008-08-26
  • 打赏
  • 举报
回复
foreach (RepeaterItem item in rpDicInclude.Items)
{
CheckBox chk = (CheckBox)item.FindControl("dicInclude");
if (chk != null)
{
Label lbl = (Label)item.FindControl("IncID");
Response.Write(lbl.Text);
}
}
zlkingdom 2008-08-26
  • 打赏
  • 举报
回复
顶起来,1楼的方法是正确的
amandag 2008-08-25
  • 打赏
  • 举报
回复
是在客户端得到还是在服务器端得到,服务器端的楼上即可
ZengHD 2008-08-25
  • 打赏
  • 举报
回复
        foreach (RepeaterItem item in rpDicInclude.Items)
{
CheckBox chk = (CheckBox)item.FindControl("dicInclude");
if (chk != null)
{
Label lbl = (Label)item.FindControl("IncID");
Response.Write(lbl.Text);
}
}

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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