.apsx
.aspx.cs
if (lblName.Text== "Muhammad Ali")
{
lblName.Style.Add("color", "green");
}
else
{
lblName.Style.Add("color", "red");
}
The above lines of code segment are self explanatory. I am checking that if name is Muhammad Ali then asp:Label color will be green else color will be red. Simply I use built-in Add function of Style class to give inline css to asp:Label in c# code behind.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment