我一直在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