예제 #1
0
    protected void GridView_AssignedCriteria_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int ID         = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grading_Type").ToString());
                int Grade_Type = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grade_Type").ToString());

                CheckBoxList rdo = (CheckBoxList)e.Row.FindControl("chkOptions");
                DataTable    dt  = BLL_Crew_Evaluation.Get_GradingOptions(ID);

                rdo.DataSource = dt;
                rdo.DataBind();
                int       Evaluation_ID = UDFLib.ConvertToInteger(Request.QueryString["EID"].ToString());
                int       Criteria_ID   = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Criteria_ID").ToString());
                DataTable dtOptions     = BLL_Crew_Evaluation.Get_MandatoryGrades(Evaluation_ID, Criteria_ID);

                foreach (ListItem chki in rdo.Items)
                {
                    dtOptions.DefaultView.RowFilter = "OptionText= '" + chki.Text + "'";
                    if (dtOptions.DefaultView.Count > 0)
                    {
                        chki.Selected = true;
                    }
                }
                if (Grade_Type == 2)
                {
                    TextBox txtAnswer = new TextBox();
                    txtAnswer.Text    = "Subjective Type";
                    txtAnswer.Enabled = false;
                    e.Row.Cells[3].Controls.Add(txtAnswer);
                }
            }
        }
        catch
        {
        }
    }