F
fredd00
how can i change the back color on mouse out to the color specified in
the grid view declaration
in the gridview declaration
<AlternatingRowStyle BackColor="#CECECE" />
<RowStyle BackColor="#DEDEDE" />
the RowDataBound (i don't want to have to specify the color code, i
might want to use themes in the future)
protected virtual void RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Alternate)
{
e.Row.Attributes.Add("onmouseout",
string.Format("this.style.backgroundColor='{0}'", "#CECECE"));
}
else
{
e.Row.Attributes.Add("onmouseout",
string.Format("this.style.backgroundColor='{0}'", "#DEDEDE"));
}
e.Row.Attributes.Add("onmouseover",
"this.style.backgroundColor='orange'; this.style.cursor='pointer';");
}
}
the grid view declaration
in the gridview declaration
<AlternatingRowStyle BackColor="#CECECE" />
<RowStyle BackColor="#DEDEDE" />
the RowDataBound (i don't want to have to specify the color code, i
might want to use themes in the future)
protected virtual void RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Alternate)
{
e.Row.Attributes.Add("onmouseout",
string.Format("this.style.backgroundColor='{0}'", "#CECECE"));
}
else
{
e.Row.Attributes.Add("onmouseout",
string.Format("this.style.backgroundColor='{0}'", "#DEDEDE"));
}
e.Row.Attributes.Add("onmouseover",
"this.style.backgroundColor='orange'; this.style.cursor='pointer';");
}
}