开发者

gridview control color

开发者 https://www.devze.com 2023-03-21 06:16 出处:网络
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?

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

精彩评论

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