Пример #1
0
    protected void GridView_AssignedCriteria_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int Grading_ID = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grading_Type").ToString());
                int Grade_Type = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grade_Type").ToString());

                int    UserAnswer = 0;
                string TextAnswer = "";
                string Remarks    = "";


                RadioButtonList rdo        = (RadioButtonList)e.Row.FindControl("rdoOptions");
                TextBox         txtAnswer  = (TextBox)e.Row.FindControl("txtAnswer");
                TextBox         txtRemarks = (TextBox)e.Row.FindControl("txtRemarks");

                DataTable dt = BLL_Crew_Evaluation.Get_GradingOptions(Grading_ID);
                rdo.DataSource = dt;
                rdo.DataBind();

                int    Evaluation_ID = UDFLib.ConvertToInteger(Request.QueryString["EID"].ToString());
                string Remark        = "";
                foreach (DataRow row in dt.Rows)
                {
                    DataTable dtremark = BLL_Crew_Evaluation.Get_MandatoryRemark(UDFLib.ConvertToInteger(row["ID"].ToString()), Evaluation_ID, UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[e.Row.RowIndex].Value.ToString()));
                    if (dtremark.Rows.Count > 0)
                    {
                        if (dtremark.Rows[0]["OptionText"].ToString() == row["OptionText"].ToString())
                        {
                            Remark = Remark + row["ID"].ToString() + ";";
                        }
                    }
                }
                HiddenField hdnRemark = (HiddenField)e.Row.FindControl("hdnRemark");
                hdnRemark.Value = Remark;
                if (Grade_Type == 2)
                {
                    txtAnswer.Visible = true;
                }

                if (Request.QueryString["DtlID"] != null)
                {
                    UserAnswer = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "UserAnswer").ToString());
                    TextAnswer = DataBinder.Eval(e.Row.DataItem, "TextAnswer").ToString();
                    Remarks    = DataBinder.Eval(e.Row.DataItem, "Remarks").ToString();


                    rdo.SelectedValue = UserAnswer.ToString();
                    rdo.Enabled       = false;
                    txtAnswer.Text    = TextAnswer;

                    if (TextAnswer.Length > 100)
                    {
                        txtAnswer.Rows = (TextAnswer.Length / 40);
                    }

                    txtAnswer.ReadOnly  = true;
                    txtRemarks.Text     = Remarks;
                    txtRemarks.ReadOnly = true;
                    ((CheckBox)e.Row.FindControl("chkNA")).Enabled = false;
                }
            }
        }
        catch
        {
        }
    }