Пример #1
0
    private TableCell createEditTableCell(DataRow dr)
    {
        TableCell tcTemp = new TableCell();
        tcTemp.Attributes.Add("class", "FlowBg_now");//�˴���ӵ��ǵ�ǰ�����cell

        Label lblRegionCaption = new Label();
        lblRegionCaption.Text = DBNullConverter.ToStr(dr["RegionCaption"]);
        lblRegionCaption.ID = "lblRegionCaption";
        lblRegionCaption.Attributes.Add("class", "TxtB");
        tcTemp.Controls.Add(lblRegionCaption);
        tcTemp.Controls.Add(new LiteralControl("<br><br>"));

        Label lblApproverEx = new Label();
        if (DBNullConverter.ToInt32(dr["OnError"]) == 1)
            lblApproverEx.Text = "������:";
        else
            lblApproverEx.Text = "������:";
        lblApproverEx.Attributes.Add("class", "TxtB");
        tcTemp.Controls.Add(lblApproverEx);

        Label lblApprover = new Label();
        lblApprover.ID = "lblApprover";
        lblApprover.Text = DBNullConverter.ToStr(dr["Approver"]);
        tcTemp.Controls.Add(lblApprover);
        tcTemp.Controls.Add(new LiteralControl("<br><br>"));

        Label lblrequiredLable = new Label();
        lblrequiredLable.Text = "*";
        lblrequiredLable.ForeColor = System.Drawing.Color.Red;
        tcTemp.Controls.Add(lblrequiredLable);
        Label lblStatus = new Label();
        lblStatus.ID = "lblStatus";
        lblStatus.Text = "����״̬:" + setHighLight(dr["IsOutTime"].ToString());
        lblStatus.Attributes.Add("class", "TxtB");
        tcTemp.Controls.Add(lblStatus);
        tcTemp.Controls.Add(new LiteralControl("<br><br>"));

        //Dim radApprove As RadioButton = New RadioButton
        radApprove.ID = "radApprove";
        if (DBNullConverter.ToInt32(dr["OnError"]) == 1)
            radApprove.Text = "���Իָ�";
        else {
            radApprove.Text = "ͬ��";
            radApprove.CheckedChanged += new EventHandler(radApprove_CheckedChanged);
        }
        radApprove.GroupName = "gnStatus";
        radApprove.Checked = true;
        radApprove.AutoPostBack = true;
        tcTemp.Controls.Add(radApprove);
        tcTemp.Controls.Add(new LiteralControl("<br><br>"));

        //Dim radReject As RadioButton = New RadioButton
        radReject.ID = "radReject";
        if (DBNullConverter.ToInt32(dr["OnError"]) == 1)
            radReject.Text = "�˻ص���";
        else {
            radReject.Text = "�ܾ�";
            radReject.CheckedChanged += new EventHandler(radApprove_CheckedChanged);
        }
        radReject.GroupName = "gnStatus";
        radReject.AutoPostBack = true;
        tcTemp.Controls.Add(radReject);
        tcTemp.Controls.Add(new LiteralControl("&nbsp;&nbsp;"));

        //if (radReject.Checked)
        //{
        //    lblRejectReason.Text = "Reject Reason:";
        //    lblRejectReason.ID = "lblRejectReason";
        //    lblRejectReason.Attributes.Add("class", "TxtB");
        //    lblRejectReason.Visible = false;
        //    tcTemp.Controls.Add(lblRejectReason);
        //    tcTemp.Controls.Add(new LiteralControl("<br><br>"));

        ddlReject.ID = "ddlReject";
        ddlReject.Width = new Unit("142px");
        ddlReject.Visible = false;
        ddlReject.DataValueField = "RejectReasonId";
        ddlReject.DataTextField = "RejectReasonTitle";
        ddlReject.AutoPostBack = true;
        //RejectReasonBLL bll = new RejectReasonBLL();
        if (DBNullConverter.ToInt32(dr["OnError"]) == 1) {
            tcTemp.Controls.Add(new LiteralControl("<br><br>"));
        } else {
            MasterDataBLL bll = new MasterDataBLL();
            ddlReject.DataSource = bll.GetRejectReason();
            ddlReject.DataBind();
            ddlReject.Items.Insert(0, new ListItem("---����ѡ��---", ""));
            ddlReject.SelectedIndexChanged += new EventHandler(ddlReject_SelectedIndexChanged);
            tcTemp.Controls.Add(ddlReject);
            tcTemp.Controls.Add(new LiteralControl("<br><br>"));

            Label lblComments = new Label();
            lblComments.Text = "�������:";
            lblComments.ID = "lblComments";
            lblComments.Attributes.Add("class", "TxtB");
            tcTemp.Controls.Add(lblComments);
            tcTemp.Controls.Add(new LiteralControl("<br><br>"));
        }

        txtComments.ID = "txtComments";
        txtComments.Width = 200;
        txtComments.Height = 50;
        txtComments.TextMode = TextBoxMode.MultiLine;
        txtComments.Rows = 5;
        txtComments.Columns = 20;
        if (DBNullConverter.ToInt32(dr["OnError"]) == 1) {
            txtComments.Text = DBNullConverter.ToStr(dr["Comment"]);
            txtComments.ReadOnly = true;
        } else {
            txtComments.Attributes.Add("onchange", "javascript:return textLimit(this,100);");
        }
        //txtComments.Attributes.Add("onKeyUp", "javascript:textLimit(this,100);")
        tcTemp.Controls.Add(txtComments);

        return tcTemp;
    }