Пример #1
0
 public static sbyte Isradio(RadioButtonList radioButtonList)
 {
     if (radioButtonList.SelectedValue == "")
     {
         radioButtonList.Focus();
         return(2);
     }
     else
     {
         return(1);
     }
 }
Пример #2
0
    public bool ValidateGrid(TextBox txtcondition, RadioButtonList rblavlblity, RadioButtonList rblworkcondition)
    {
        if (txtcondition.Text == "")
        {
            cf.ShowAlertMessage("Enter Condition");
            txtcondition.Focus();
            return(false);

            divequipment.Visible = true;
        }
        if (rblavlblity.SelectedIndex == 0)
        {
            cf.ShowAlertMessage("Select Availability");
            rblavlblity.Focus();
            return(false);
        }
        if (rblworkcondition.SelectedIndex == 0)
        {
            cf.ShowAlertMessage("Select work condtion");
            rblavlblity.Focus();
            return(false);
        }
        return(false);
    }
    protected void txtAppoinmentDate_TextChanged(object sender, EventArgs e)
    {
        GridViewRow     gvr               = (GridViewRow)((TextBox)sender).Parent.Parent;
        RadioButtonList rbtPaymentType    = gvr.FindControl("rbtPaymentType") as RadioButtonList;
        Label           lblAppoinmentDate = gvr.FindControl("lblAppoinmentDate") as Label;
        TextBox         txtAppoinmentDate = gvr.FindControl("txtAppoinmentDate") as TextBox;

        if (Convert.ToDateTime(txtAppoinmentDate.Text) > Convert.ToDateTime(DateTime.Now.ToString()))
        {
            lblAppoinmentDate.Visible = false;
            rbtPaymentType.Focus();
        }
        else
        {
            lblAppoinmentDate.Visible = true;
            lblAppoinmentDate.Text    = "Select valid date";
            txtAppoinmentDate.Text    = "";
            txtAppoinmentDate.Focus();
        }
    }
Пример #4
0
    protected bool ValidateGrid(RadioButtonList rdblist, DropDownList ddlreject)
    {
        if (rdblist.SelectedIndex == -1)
        {
            ObjCommon.ShowAlertMessage("Select Accept/Reject");
            rdblist.Focus();
            return(false);
        }
        else if (rdblist.SelectedValue == "R")
        {
            if (ddlreject.SelectedIndex == 0)
            {
                ObjCommon.ShowAlertMessage("Select Rejected Reasons");
                ddlreject.Focus();
                return(false);
            }
        }

        return(true);
    }
Пример #5
0
    protected void txtFullName_TextChanged1(object sender, EventArgs e)
    {
        GridViewRow     gvr              = (GridViewRow)((TextBox)sender).Parent.Parent;
        TextBox         txtFullName      = gvr.FindControl("txtFullName") as TextBox;
        Label           lblFullNameError = gvr.FindControl("lblFullNameError") as Label;
        RadioButtonList rbtGender        = gvr.FindControl("rbtGender") as RadioButtonList;
        String          alpha            = "^[A-Za-z ]+$";

        if (Regex.IsMatch(txtFullName.Text, alpha))
        {
            lblFullNameError.Visible = false;
            rbtGender.Focus();
        }
        else
        {
            lblFullNameError.Visible = true;
            lblFullNameError.Text    = "Please Enter only Alpha";
            txtFullName.Text         = "";
            txtFullName.Focus();
        }
    }
Пример #6
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["Project"] != 0)
        {
            QNA_ResultBLL r = new QNA_ResultBLL();
            r.Model.Project      = (int)ViewState["Project"];
            r.Model.RelateClient = (int)ViewState["RelateClient"];
            r.Model.RelateTask   = (int)ViewState["RelateTask"];
            r.Model.InsertStaff  = (int)Session["UserID"];

            foreach (RepeaterItem _ri in Repeater1.Items)
            {
                int             question   = int.Parse(((Label)_ri.FindControl("lb_ID")).Text);
                RadioButtonList rbl_Result = (RadioButtonList)_ri.FindControl("rbl_Result");
                CheckBoxList    cbl_Result = (CheckBoxList)_ri.FindControl("cbl_Result");
                TextBox         tbx_Result = (TextBox)_ri.FindControl("tbx_Result");

                if (cbl_Result.Visible && cbl_Result.SelectedValue != "")
                {
                    foreach (ListItem item in cbl_Result.Items)
                    {
                        if (item.Selected)
                        {
                            QNA_Result_Detail _resultdetail = new QNA_Result_Detail();
                            _resultdetail.Question = question;
                            _resultdetail.Option   = int.Parse(item.Value);
                            r.Items.Add(_resultdetail);
                        }
                    }
                }

                if (rbl_Result.Visible)
                {
                    if (rbl_Result.SelectedValue == "")
                    {
                        MessageBox.Show(this, "单选列表中,您必须选择一项!");
                        rbl_Result.Focus();
                        return;
                    }
                    else
                    {
                        QNA_Result_Detail _resultdetail = new QNA_Result_Detail();
                        _resultdetail.Question = question;
                        _resultdetail.Option   = int.Parse(rbl_Result.SelectedValue);
                        r.Items.Add(_resultdetail);
                    }
                }

                if (tbx_Result.Visible)
                {
                    if (tbx_Result.Text == "")
                    {
                        MessageBox.Show(this, "文本框中,您必须填写内容!");
                        tbx_Result.Focus();
                        return;
                    }
                    else
                    {
                        QNA_Result_Detail _resultdetail = new QNA_Result_Detail();
                        _resultdetail.Question   = question;
                        _resultdetail.OptionText = tbx_Result.Text;
                        r.Items.Add(_resultdetail);
                    }
                }
            }

            Session["QuestionnaireResult"] = r.Add();

            MessageBox.ShowAndClose(this, "问卷保存成功!");
        }
    }