gridview 如何显示HTML标签

yilingjingshui 2013-05-29 11:11:58
后台给数据添加了一个样式 如<span class='red'>数据</span>想让数据显示成红色 请问要如何处理啊
...全文
215 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
yilingjingshui 2013-05-29
  • 打赏
  • 举报
回复
引用 3 楼 Chinajiyong 的回复:
gridview模板列处理
还在吗 能详细说下你的解决方案吗
yilingjingshui 2013-05-29
  • 打赏
  • 举报
回复
style1.ForeColor = Color.Red; 这个是设置成红色[/quote] <span class='red'>数据</span>这个是在服务器设置好的,不能在本地固定
removeLove 2013-05-29
  • 打赏
  • 举报
回复
引用 6 楼 yilingjingshui 的回复:
我的是窗体程序
style1.ForeColor = Color.Red; 这个是设置成红色
removeLove 2013-05-29
  • 打赏
  • 举报
回复
引用 6 楼 yilingjingshui 的回复:
我的是窗体程序
this.dataGridView1.Rows.Clear(); int index = 0; for (int i = 0; i < 5; i++) { index = dataGridView1.Rows.Add(); dataGridView1[id.Index, index].Value = i + 1; dataGridView1[name.Index, index].Value ="小米"+ i; dataGridView1[age.Index, index].Value = 18 + i; DataGridViewCellStyle style1 = new DataGridViewCellStyle(); Font f1 = new Font("宋体", 13, FontStyle.Regular); style1.Font = f1; dataGridView1[name.Index, index].Style = style1; }
yilingjingshui 2013-05-29
  • 打赏
  • 举报
回复
我的是窗体程序
yilingjingshui 2013-05-29
  • 打赏
  • 举报
回复
引用 2 楼 removeLove 的回复:
你是先让控件里面的内容显示成红色吗?
能给个例子看看吗 小弟刚学没多久之前一直弄JAVA的
yilingjingshui 2013-05-29
  • 打赏
  • 举报
回复
引用 1 楼 yilingjingshui 的回复:
在线等高手啊
是啊 就想让字体变色
EnForGrass 2013-05-29
  • 打赏
  • 举报
回复
gridview模板列处理
removeLove 2013-05-29
  • 打赏
  • 举报
回复
你是先让控件里面的内容显示成红色吗?
yilingjingshui 2013-05-29
  • 打赏
  • 举报
回复
在线等高手啊
yilingjingshui 2013-05-29
  • 打赏
  • 举报
回复
[quote=引用 13 楼 hyde100 的回复:]
<span style=" color:Red;">数据</span>
[/quote 我这边先在是直接显示的]<span style=" color:Red;">数据</span>它 也就是没有解析HTML
hyde100 2013-05-29
  • 打赏
  • 举报
回复
<span style=" color:Red;">数据</span>
coobai 2013-05-29
  • 打赏
  • 举报
回复
class 是样式。 如果你直接 class='red' 则需要定义 red样式。即css .red{color:red}
coobai 2013-05-29
  • 打赏
  • 举报
回复
<span class='color:red'>数据</span>

111,093

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧