Llemon, as Lethal suggested, you can call it from the aspx page or from your .vb code.
I'd suggest calling it from vb code, only because it helps seperate design from function.
VB Code:
<ASP:Repeater runat="server" DataSource='<%# dsFullList.DefaultView %>'> <ItemTemplate> <tr> <td><asp:Label runat="server" id="lblID"></asp:Label></td> <td><asp:Label runat="server" ud="lblName"></asp:Label> </td> <td><asp:Label runat="server id="lblRA_On"></asp:Label></td> <td><asp:Label runat="server" id="lblENTRY_DT"></asp:Label> </td> </tr> </ItemTemplate> </ASP:Repeater>
VB Code:
Private Sub yourRepeater_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles yourRepeater.ItemDataBound If (e.Item.ItemType = ListItemType.Item) OrElse _ (e.Item.ItemType = ListItemType.AlternatingItem) Then Dim dbr As System.Data.Common.DbDataRecord = CType(e.Item.DataItem, System.Data.Common.DbDataRecord) Dim x As Label x = DirectCast(e.Item.Controls("lblID"), Label) x.Text = dbr(1).ToString x = DirectCast(e.Item.Controls(3), Label) x.Text = dbr("Name").ToString x = DirectCast(e.Item.Controls(5), Label) If dbr("RA_ON") = 0 Then x.Text = "NO" Else x.Text = "YES" End If x = DirectCast(e.Item.Controls(7), Label) x.Text = dbr("ENTRY_DT") End If End Sub
Notice how you can call controls by their name or index... the index may be different depending if you have a table in your repeater or not... etc..




Reply With Quote