Adding Style to Repeater Controls in runtime

Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles RptGuestNEmployee.ItemDataBound   Dim htmlTblCell As HtmlTableCell

If e.Item.ItemType.AlternatingItem Or e.Item.ItemType.Item Then
htmlTblCell = e.Item.FindControl("tdOutDollars")
If Not htmlTblCell Is Nothing Then
If htmlTblCell.InnerHtml <> " " Then htmlTblCell.Style.Add("color", "green")
End If
End If
End Sub
<TD align="right" nowrap="true" id="tdOutDollars" runat=server> <%# DataBinder.Eval(Container.DataItem,"OutDollars","{0:N}") %> </TD>

Leave a Reply

Your email address will not be published. Required fields are marked *