Hi slb2013,
Please refer below sample.
HTML
Default
<uc:Signal runat="server" ID="ucSignal" />
User Control
<%foreach (Signal message in this.SignalData)
{%>
<span class='<%=message.SignalStrength=="Pass"?"Green":"Red" %>'>
<%=message.SignalStrength%></span><br />
<%} %>
<style type="text/css">
.Green
{
font-family: Arial;
font-size: 10pt;
color: green;
}
.Red
{
font-family: Arial;
font-size: 10pt;
color: red;
}
</style>
Signal Class
C#
public class Signal
{
public string SignalStrength { get; set; }
public int Percent { get; set; }
}
Code
UserControl
public List<Signal> SignalData { get; set; }
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
ucSignal.SignalData = new List<Signal>()
{
new Signal{ SignalStrength="Fail",Percent=10},
new Signal{ SignalStrength="Pass",Percent=80},
};
}
}
Screenshot