예제 #1
0
 protected void OnASPxPivotGridCustomCellStyle(object sender, PivotCustomCellStyleEventArgs e)
 {
     if (null == Session["SelectedValue"] || null == Session["SelectedArea"])
     {
         e.CellStyle.BackColor = Color.White;
     }
     else
     {
         string    selectedValue = (string)Session["SelectedValue"];
         PivotArea selectedArea  = (PivotArea)Session["SelectedArea"];
         if (PivotArea.ColumnArea == selectedArea)
         {
             if (e.ColumnValueType == PivotGridValueType.GrandTotal)
             {
                 e.CellStyle.BackColor =
                     "Grand Total" == selectedValue ? Color.AliceBlue : Color.White;
             }
             else
             {
                 bool selected = false;
                 foreach (PivotGridField field in e.GetColumnFields())
                 {
                     if (e.GetFieldValue(field).ToString() == selectedValue)
                     {
                         selected = true;
                         break;
                     }
                 }
                 e.CellStyle.BackColor = selected ? Color.AliceBlue : Color.White;
             }
         }
         else if (PivotArea.RowArea == selectedArea)
         {
             if (e.RowValueType == PivotGridValueType.GrandTotal)
             {
                 e.CellStyle.BackColor =
                     "Grand Total" == selectedValue ? Color.AliceBlue : Color.White;
             }
             else
             {
                 bool selected = false;
                 foreach (PivotGridField field in e.GetRowFields())
                 {
                     if (e.GetFieldValue(field).ToString() == selectedValue)
                     {
                         selected = true;
                         break;
                     }
                 }
                 e.CellStyle.BackColor = selected ? Color.AliceBlue : Color.White;
             }
         }
         else
         {
             e.CellStyle.BackColor = Color.White;
         }
     }
 }
예제 #2
0
    protected void pivotM_CustomCellStyle(object sender, PivotCustomCellStyleEventArgs e)
    {
        if (e.ColumnValueType == PivotGridValueType.Value)
        {
            if (rblObj.Value.ToString() != "Grid Counts")
            {
                if (e.Value != null)
                {
                    Color cellcolor = color.GetStatus_Color(color.StatusType.Measure, e.Value.ToString(), Convert.ToInt32(sliderValue.Value));
                    e.CellStyle.BackColor = cellcolor;
                }
            }

            else
            {
                var rowfield = e.RowField;
                if (rowfield != null)
                {
                    var v = e.GetFieldValue(e.RowField).ToString();
                    if (v != null)
                    {
                        Color cellcolor = color.GetStatus_Color(color.StatusType.Measure, v.ToString(), Convert.ToInt32(sliderValue.Value));
                        e.CellStyle.BackColor = cellcolor;
                    }
                }
            }
        }
    }
    protected void pivotENT_CustomCellStyle(object sender, PivotCustomCellStyleEventArgs e)
    {
        if (e.ColumnValueType == PivotGridValueType.Value)
        {
            if (rblObj.Value.ToString() != "Grid Counts")
            {
                if (e.Value != null)
                {
                    Color cellcolor = color.GetStatus_Color(color.StatusType.Subject, e.Value.ToString(), color.GetColorLevel());
                    e.CellStyle.BackColor = cellcolor;
                }
            }

            else
            {
                var rowfield = e.RowField;
                if (rowfield != null)
                {
                    var v = e.GetFieldValue(e.RowField).ToString();
                    if (v != null)
                    {
                        Color cellcolor = color.GetStatus_Color(color.StatusType.Subject, v.ToString(), color.GetColorLevel());
                        e.CellStyle.BackColor = cellcolor;
                    }
                }
            }
        }
    }