更改GridView列的字体颜色 [英] Change font color for a GridView column
本文介绍了更改GridView列的字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我的GridView进入中继器。
所以在它绑定之后我'我试图更改第二列的字体颜色。
Hi there!
My GridView is into Repeater.
So after its binding I''m trying to change font color of the 2nd column.
protected void Page_Load(object sender, EventArgs e)
{
GridView gv = (GridView)Page.FindControl("GridView1");
gv.Columns[1].ControlStyle.ForeColor = System.Drawing.Color.Red;
}
但是收到了错误。
我应该使用什么事件?
谢谢!
But got an error.
What event should I use?
Thank you!
推荐答案
解决了!
Solved!
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].ForeColor = System.Drawing.Color.Red;
}
这篇关于更改GridView列的字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文