我一直在vb.net中使用中继器,并且对它们没有任何问题,但是我正在处理一些c#并且无法完成转换(以及在线转换jobby似乎没有工作)从VB.net在C#中使用中继器示例
我有我的中继器设置出像:
<asp:Repeater runat="server" ID="rptItems">
<ItemTemplate>
<div class="span12 grey-box">
<div class="hero-block3">
<div class="row show-grid">
<div class="span9">
<div class="hero-content-3">
<h2><asp:Literal ID="ltrName" runat="server"></asp:Literal></h2>
<p><asp:Literal ID="ltrDescription" runat="server"></asp:Literal></p>
</div>
</div>
<div class="span3">
<div class="tour-btn">
<small>How Many?<br /></small>
<asp:TextBox runat="server" ID="tbox" Width="40"></asp:TextBox>
</div>
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
而且继承人如何我通常填充它在vb.net
Private Sub rptItems_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptClientList.ItemDataBound
Dim nRow As DataRowView = Nothing
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
With e.Item
nRow = DirectCast(e.Item.DataItem, DataRowView)
With DirectCast(.FindControl("ltrText"), Literal)
.Text = nRow("Description")
End With
With DirectCast(.FindControl("ltrTitle"), Literal)
.Text = nRow("Name")
End With
End With
End Select
End Sub
你为什么不直接使用数据绑定?这是有原因的吗? – 2013-05-10 15:03:54
是的,我需要做一个if语句内的绑定循环基本上如果boolean = true,隐藏特定元素 – TMB87 2013-05-10 15:04:27