Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                System.Drawing.Color col  = System.Drawing.Color.White;
                DataRowView          view = e.Row.DataItem as DataRowView;

                int            status    = ConvertEx.ToInt(view["SIGNATURE_FLAG"]);
                CBLL.ColorList colorList = new ColorList();
                col             = colorList.GetMyColor((status * 10).ToString());
                e.Row.BackColor = col;
                for (int i = 0; i < e.Row.Cells.Count; i++)
                {
                    if (!ConvertEx.ToBool(view["IsFolder"]))
                    {
                        e.Row.Cells[i].BackColor = col;
                    }
                }

                if (Common.ConvertEx.ToBool(view["IsFolder"]))
                {
                    for (int i = 1; i < e.Row.Cells.Count; i++)
                    {
                        foreach (Control control in e.Row.Cells[i].Controls)  //禁用文件节点
                        {
                            if (control is HtmlControl)
                            {
                                if (control is HtmlInputText)
                                {
                                    ((HtmlInputText)control).Attributes.Add("style", "border:solid 0px");
                                }

                                ((HtmlControl)control).Disabled = true;
                            }
                            if (control is WebControl)
                            {
                                if (control is TextBox)
                                {
                                    ((TextBox)control).Attributes.Add("style", "border:solid 0px");
                                }

                                ((WebControl)control).Enabled = false;
                            }
                        }
                    }
                }
            }
        }