Hi Tevin,
Please refer below sample.
HTML
<asp:Repeater ID="rpLabelColors" Visible="true" runat="server">
<HeaderTemplate>
<table id="tblAllColors" class="table table-striped table-bordered table-hover table-condensed" style="height: 50px;" border="1">
<tr>
<th>Color Name</th>
<th>Color Hex Code</th>
<th>Color</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "ColorName").ToString() %>' runat="server" ID="lblColorName" /></td>
<td style='<%# "background-color:" + DataBinder.Eval(Container.DataItem, "ColorHexCode") + ";" %>'>
<asp:Label Style='<%# "background-color:" + DataBinder.Eval(Container.DataItem, "ColorHexCode") + ";" %>' runat="server" ID="lblColorHexCode" /></td>
<td><asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "ColorHexCode") %>' runat="server" ID="lblColor" /></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<div class="panel-footer"></div>
</table>
</FooterTemplate>
</asp:Repeater>
Namespace
C#
using System.Data;
VB.Net
Imports System.Data
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[]{
new DataColumn("ColorName"),
new DataColumn("ColorHexCode")
});
dt.Rows.Add("Orange", "#F4680A");
dt.Rows.Add("Red", "#FF0000");
dt.Rows.Add("Green", "#00F200");
rpLabelColors.DataSource = dt;
rpLabelColors.DataBind();
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim dt As DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn() {New DataColumn("ColorName"), New DataColumn("ColorHexCode")})
dt.Rows.Add("Orange", "#F4680A")
dt.Rows.Add("Red", "#FF0000")
dt.Rows.Add("Green", "#00F200")
rpLabelColors.DataSource = dt
rpLabelColors.DataBind()
End Sub
Screenshot