码迷,mamicode.com
首页 > 其他好文 > 详细

Gridview单双行

时间:2014-07-25 14:25:11      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:color   re   c   ar   type   table   view   css   

.table01_singlar
        {
            background-color: #FFFFFF;
        }
.table01_double
        {
            background-color: #e5eaf0;
        }

OnRowDataBound="gvData_RowDataBound"

        protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
        {
           //添加样式-----------begin
            switch (e.Row.RowType)
            {
                case DataControlRowType.DataRow:
                    if (e.Row.RowIndex > -1)
                    {
                        // 奇数行
                        if (e.Row.RowIndex % 2 == 0)
                        {
                            e.Row.CssClass = "table01_singlar";
                        }
                        else
                        {
                            e.Row.CssClass = "table01_double";
                        }
                    }
                    break;
            }
            //------------------end
        }

Gridview单双行,布布扣,bubuko.com

Gridview单双行

标签:color   re   c   ar   type   table   view   css   

原文地址:http://www.cnblogs.com/PeaCode/p/3867803.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!