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
}
}
精彩评论