表格判断奇偶行

添加人:guorui1314零级(77分)   添加时间:2008-05-26    阅读次数:676  收藏此教程
        protected void CommonGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow) //通过DV的 E的参数 来判断类型
            {
                //jt:奇数行与偶数行的onmouseover及onmouseout的颜色变换
                if (Convert.ToInt16(ViewState["LineNo"]) == 0)
                {
                    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#498AB5';this.style.color='#FFFFFF'");
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#F7F6F3';this.style.color='#333333'");
                    ViewState["LineNo"] = 1;
                }
                else
                {
                    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#498AB5';this.style.color='#FFFFFF'");
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF';this.style.color='#284775'");
                    ViewState["LineNo"] = 0;
                }
                //jt:显示催收状态
                string stateCode = e.Row.Cells[5].Text.ToString();
                string stateName = dunStateMothod.GetFullStateNameByStatecode(stateCode, "/");
                e.Row.Cells[5].Text = stateName;
            }
        }
1页 第1上一页1下一页
相关的教程: 表格判断奇偶行
收藏此教程

当前平均分: 0.2(5 次打分)

-5-4-3-2-1012345
评论主题
您的大名
您的评论
验证码 点击换一个验证码
知识库搜索: