public void gvResult_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                try
                {
                    Label                lbl     = (Label)e.Row.Cells[0].FindControl("lblStepID");
                    Label                lbl2    = (Label)e.Row.Cells[0].FindControl("lblMeasureID");
                    CTL_PLAN_MEASURE     measure = coaReport.CtlPlan.CtlPlan.CTL_PLAN_STEP.First(s => s.CTLPLANSTEP_ID == Convert.ToInt32(lbl.Text)).CTL_PLAN_MEASURE.First(m => m.CTLMEASURE_ID == Convert.ToInt32(lbl2.Text));
                    CTL_PLAN_MEASURE_SUM stats   = measure.CTL_PLAN_MEASURE_SUM.First();

                    /*
                     * lbl = (Label)e.Row.Cells[0].FindControl("lblResults");
                     * lbl.Text = ("N: " + stats.SAMPLES.ToString()
                     + " XB: " + stats.MEAN.ToString()
                     + " CP: " + stats.CP.ToString()
                     + " CPk: " + stats.CPK.ToString());
                     */
                    List <MetricString> statsList = new List <MetricString>();
                    statsList.Add(new MetricString().New("Samples", Convert.ToDouble(stats.SAMPLES)));
                    statsList.Add(new MetricString().New("Samples", stats.MEAN));

                    GridView gv = (GridView)e.Row.Cells[0].FindControl("gvMetricGrid");
                    gv.DataSource = statsList;
                    gv.DataBind();
                }
                catch
                {
                }
            }
        }
        public void gvMeasure_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                try
                {
                    Label       lbl = (Label)e.Row.Cells[0].FindControl("lblSpecValues");
                    HiddenField hf  = (HiddenField)e.Row.Cells[0].FindControl("hfSpecLSL");
                    lbl.Text  = hf.Value;
                    hf        = (HiddenField)e.Row.Cells[0].FindControl("hfSpecUSL");
                    lbl.Text += (" / " + hf.Value);
                    hf        = (HiddenField)e.Row.Cells[0].FindControl("hfUOM");
                    lbl.Text += (" " + hf.Value);

                    hf = (HiddenField)e.Row.Cells[0].FindControl("hfStepID");
                    HiddenField          hf2     = (HiddenField)e.Row.Cells[0].FindControl("hfMeasureID");
                    CTL_PLAN_MEASURE     measure = coaReport.CtlPlan.CtlPlan.CTL_PLAN_STEP.First(s => s.CTLPLANSTEP_ID == Convert.ToInt32(hf.Value)).CTL_PLAN_MEASURE.First(m => m.CTLMEASURE_ID == Convert.ToInt32(hf2.Value));
                    CTL_PLAN_MEASURE_SUM stats   = measure.CTL_PLAN_MEASURE_SUM.First();

                    List <MetricString> statsList = new List <MetricString>();
                    statsList.Add(new MetricString().New("Samples:", stats.SAMPLES));
                    statsList.Add(new MetricString().New("Mean:", stats.MEAN));
                    statsList.Add(new MetricString().New("Sdev:", stats.SDEV));
                    if (measure.MEASURE_TYPE == "VAR")
                    {
                        statsList.Add(new MetricString().New("CP:", stats.CP));
                        statsList.Add(new MetricString().New("CPk:", stats.CPK));
                    }

                    GridView gv = (GridView)e.Row.Cells[0].FindControl("gvMetricGrid");
                    gv.DataSource = statsList;
                    gv.DataBind();
                }
                catch
                {
                }
            }
        }