Protected
Sub form1_Load()
Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Dim nvc As System.Collections.Specialized.NameValueCollection = New System.Collections.Specialized.NameValueCollection()
nvc.Add("A", "1")
nvc.Add("B", "2")
nvc.Add("C", "3")
nvc.Add("D", "110")
nvc.Add("E", "5")
nvc.Add("F", "6")
Repeater1.DataSource = nvc
Repeater1.DataBind()
End Sub
Protected Sub Repeater1_ItemDataBound() Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
If (e.Item.ItemType = ListItemType.Item) Or _
(e.Item.ItemType = ListItemType.AlternatingItem) Then
Dim oColl As NameValueCollection = Repeater1.DataSource
Dim lblName As Label = e.Item.FindControl("lblName")
lblName.Text = e.Item.DataItem.ToString()
Dim lblValue As Label = e.Item.FindControl("lblValue")
lblValue.Text = oColl(lblName.Text)
End If
End Sub
Dim nvc As System.Collections.Specialized.NameValueCollection = New System.Collections.Specialized.NameValueCollection()
nvc.Add("A", "1")
nvc.Add("B", "2")
nvc.Add("C", "3")
nvc.Add("D", "110")
nvc.Add("E", "5")
nvc.Add("F", "6")
Repeater1.DataSource = nvc
Repeater1.DataBind()
End Sub
Protected Sub Repeater1_ItemDataBound() Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
If (e.Item.ItemType = ListItemType.Item) Or _
(e.Item.ItemType = ListItemType.AlternatingItem) Then
Dim oColl As NameValueCollection = Repeater1.DataSource
Dim lblName As Label = e.Item.FindControl("lblName")
lblName.Text = e.Item.DataItem.ToString()
Dim lblValue As Label = e.Item.FindControl("lblValue")
lblValue.Text = oColl(lblName.Text)
End If
End Sub
<
div
>
< asp:Repeater ID ="Repeater1" runat ="server" >
< HeaderTemplate >< table >< tr ></ HeaderTemplate >
< ItemTemplate >< td >< asp:Label ID ="lblName" runat ="server" ></ asp:Label > < asp:Label ID ="lblValue" runat ="server" ></ asp:Label >
</ td ></ ItemTemplate >
< FooterTemplate ></ tr ></ table ></ FooterTemplate >
</ asp:Repeater >
</ div >
< asp:Repeater ID ="Repeater1" runat ="server" >
< HeaderTemplate >< table >< tr ></ HeaderTemplate >
< ItemTemplate >< td >< asp:Label ID ="lblName" runat ="server" ></ asp:Label > < asp:Label ID ="lblValue" runat ="server" ></ asp:Label >
</ td ></ ItemTemplate >
< FooterTemplate ></ tr ></ table ></ FooterTemplate >
</ asp:Repeater >
</ div >