我有2个gridview控件,其中一个gridview控件添加了如下代码
protected void gvPagePartConfig_RowDataBound(object sender, GridViewRowEventArgs e)
{
switch (e.Row.RowType)
{
case DataControlRowType.Header:
e.Row.BackColor = System.Drawing.Color.White;
break;
case DataControlRowType.DataRow:
string strID = e.Row.Cells[1].Text.Trim();
if (Convert.ToInt32(ViewState["LineNo"]) == 0) //如果是奇数行
{
e.Row.Attributes.Add("onMouseOut", "SetOldColor(this);");
e.Row.Attributes.Add("onMouseOver", "SetNewColor(this);");
e.Row.Attributes.Add("onKeyOut", "SetOldColor(this);");
e.Row.Attributes.Add("onKeyOver", "this.style.background='#C0C0FF'");
ViewState["LineNo"] = 1;
&