开发者

gridview control color

I have an editable gridview. I was able to change the color of the column heads but I couldn't figure it how to change the control links (edit,update,cancel) color? It's blue in default a开发者_如何学Cnd that doesn't look good in a black background.

Thank you


You can use GridView1_RowDataBound method for this.

<asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound" >
...
</asp:GridView>

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    // searching through the rows
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        bool isnew = (bool)DataBinder.Eval(e.Row.DataItem, "IsNew");
        if ( isnew ) e.Row.BackColor = Color.FromName("#FAF7DA"); // is a "new" row
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜