我有一个调查样式页面,我想设置控件以防问题没有回答我已将以下代码附加到文字.我想知道我是否可以将文字内的文字颜色改为红色.
if (RadioButtonList1.SelectedItem == null)
{
string showmsg = "Please Answer Question";
Literal1.Text = showmsg;
}
Run Code Online (Sandbox Code Playgroud)
提供HTML作为,
string showmsg = "<span style='color:red'> Please Answer Question </span>";
Run Code Online (Sandbox Code Playgroud)
这将呈现为多个跨度.如果你使用其他支持C#代码颜色变化的控件,那就更好了.喜欢Label并使用它的属性Label.ForeColor
| 归档时间: |
|
| 查看次数: |
13808 次 |
| 最近记录: |