首页 > 代码库 > C#小常识,持续更新..

C#小常识,持续更新..

1.cs部分添加隐藏样式IntegratedEquipmentblock.Style.Add("display", "none");

 

2.gridview添加奇偶行样式protected void gvIntegratedEquipmentList_RowDataBound(object sender, GridViewRowEventArgs e)        {            //添加样式-----------begin            switch (e.Row.RowType)            {                case DataControlRowType.Header:                    e.Row.CssClass = "table01_th";                    break;                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        }

 

3.添加单元格背景色e.Row.Cells[0].BackColor = (System.Drawing.Color)new WebColorConverter().ConvertFromString("#d0cfce");