Inheritance: AnimationExtenderControlBase
    private void CreateControlsInt(int adultCntInt, int ChildCntInt, int infCntInt)
    {
        #region RaviValidations

        try
        {

            #region DomesticFlights
            for (int i = 1; i <= adultCntInt; i++)
            {
                TableRow tr = new TableRow();
                TableCell td1 = new TableCell();
                td1.Text = "Adult" + i;
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(td1);

                TableCell tdSp = new TableCell();
                tdSp.Text = "";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdSp);

                TableCell tdtitle = new TableCell();
                tdtitle.Text = "Title :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdtitle);

                TableCell td2 = new TableCell();
                DropDownList ddlTitle = new DropDownList();
                ddlTitle.CssClass = "lj_inp";
                ddlTitle.Width = 55;
                ddlTitle.ID = "ddlTitleInt" + i;
                ddlTitle.Items.Add("Mr.");
                ddlTitle.Items.Add("Ms.");
                ddlTitle.Items.Add("Mrs.");
                ddlTitle.Attributes.Add("onchange", "javascript:AddTitle(this);");
                td2.Controls.Add(ddlTitle);
                //td2.Width = Unit.Percentage(25);
                tr.Controls.Add(td2);

                TableCell tdFN = new TableCell();
                tdFN.Text = "FirstName :";

                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdFN);

                TableCell td3 = new TableCell();
                TextBox txtFn = new TextBox();

                txtFn.MaxLength = 20;
                txtFn.CssClass = "lj_inp";
                // txtFn.Width = 110;
                txtFn.ID = "txtFnInt" + i;
                txtFn.Attributes.Add("onkeyup", "javascript:AddLetters(this);");
                td3.Controls.Add(txtFn);
                // td3.Width = Unit.Percentage(25);
                tr.Controls.Add(td3);

                TableCell td6 = new TableCell();
                RequiredFieldValidator rfv2 = new RequiredFieldValidator();

                rfv2.ID = "rfv2" + i;
                rfv2.ControlToValidate = "txtFnInt" + i;
                rfv2.ErrorMessage = "Enter First Name";
                rfv2.Display = ValidatorDisplay.None;

                rfv2.ValidationGroup = "SubmitBook";
                td6.Controls.Add(rfv2);
                tr.Controls.Add(td6);

                TableCell td12 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fte1 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fte1.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz " ;
                fte1.TargetControlID = "txtFnInt" + i;
                td12.Controls.Add(fte1);
                tr.Controls.Add(td12);

                TableCell td7 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceFirstName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceFirstName1.ID = "vceFirstName1" + i;
                vceFirstName1.TargetControlID = "rfv2" + i;

                td7.Controls.Add(vceFirstName1);
                tr.Controls.Add(td7);

                TableCell tdLN = new TableCell();
                tdLN.Text = "LastName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdLN);

                TableCell td4 = new TableCell();
                TextBox txtLn = new TextBox();
                txtLn.MaxLength = 20;
                txtLn.CssClass = "lj_inp";
                //txtLn.Width = 110;
                txtLn.ID = "txtLnInt" + i;
                txtLn.Attributes.Add("onkeyup", "javascript:AddLettersLn(this);");
                txtLn.Attributes.Add("onchange", "javascript:CheckMinChars(this);");
                td4.Controls.Add(txtLn);
                // td4.Width = Unit.Percentage(25);
                tr.Controls.Add(td4);

                TableCell td5 = new TableCell();
                RequiredFieldValidator rfv1 = new RequiredFieldValidator();
                rfv1.ID = "rfv1" + i;
                rfv1.ControlToValidate = "txtLnInt" + i;
                rfv1.ErrorMessage = "Enter Last Name";
                rfv1.Display = ValidatorDisplay.None;
                rfv1.ValidationGroup = "SubmitBook";
                td5.Controls.Add(rfv1);
                tr.Controls.Add(td5);

                TableCell td8 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceLastName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceLastName1.ID = "vceLastName1" + i;
                vceLastName1.TargetControlID = "rfv1" + i;

                td8.Controls.Add(vceLastName1);
                tr.Controls.Add(td8);

                //TableCell td9 = new TableCell();
                //RegularExpressionValidator revLastName = new RegularExpressionValidator();
                //revLastName.ID = "revLastName" + i;
                //revLastName.ControlToValidate = "txtLn" + i;
                //revLastName.ValidationExpression = "^.{2,128}$" + i;
                //revLastName.ErrorMessage="Name Should be Minimum 2 Characters";
                //revLastName.Display=ValidatorDisplay.None;
                //revLastName.ValidationGroup="SubmitBook";
                //td9.Controls.Add(revLastName);
                //tr.Controls.Add(td9);

                //TableCell td9 = new TableCell();
                //RangeValidator rvLastName = new RangeValidator();
                //rvLastName.ID = "rvLastName" + i;
                //rvLastName.ControlToValidate = "txtLn" + i;
                //rvLastName.MinimumValue = "2";
                ////rvLastName.MaximumValue = "20";
                //rvLastName.ErrorMessage = "Name Shold be Minimum 2 Characters";
                //rvLastName.Display = ValidatorDisplay.None;
                //rvLastName.ValidationGroup = "SubmitBook";
                //td9.Controls.Add(rvLastName);
                //tr.Controls.Add(td9);

                //TableCell td10 = new TableCell();
                //AjaxControlToolkit.ValidatorCalloutExtender vceLastName11 = new AjaxControlToolkit.ValidatorCalloutExtender();
                //vceLastName11.ID = "vceLastName11" + i;
                //vceLastName11.TargetControlID = "rvLastName" + i;
                //td10.Controls.Add(vceLastName11);
                //tr.Controls.Add(td10);

                TableCell td13 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fte2 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fte2.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                fte2.TargetControlID = "txtLnInt" + i;
                td12.Controls.Add(fte2);
                tr.Controls.Add(td13);

                tblAdultsInt.Controls.Add(tr);
            }

            for (int i = 1; i <= ChildCntInt; i++)
            {
                TableRow tr = new TableRow();
                TableCell td1 = new TableCell();
                td1.Text = "Child" + i;
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(td1);

                TableCell tdSp = new TableCell();
                tdSp.Text = "";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdSp);

                TableCell tdtitle = new TableCell();
                tdtitle.Text = "Title :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdtitle);

                TableCell td2 = new TableCell();
                DropDownList ddlTitle = new DropDownList();
                ddlTitle.CssClass = "lj_inp";
                ddlTitle.ID = "ddlCTitleInt" + i;
                ddlTitle.Items.Add("Mstr.");
                ddlTitle.Items.Add("Miss.");
                ddlTitle.Width = 55;

                td2.Controls.Add(ddlTitle);
                //td2.Width = Unit.Percentage(25);
                tr.Controls.Add(td2);

                TableCell tdFN = new TableCell();
                tdFN.Text = "FirstName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdFN);

                TableCell td3 = new TableCell();
                TextBox txtFn = new TextBox();
                txtFn.MaxLength = 20;
                txtFn.CssClass = "lj_inp";
                //txtFn.Width = 110;
                txtFn.ID = "txtCFnInt" + i;
                td3.Controls.Add(txtFn);
                // td3.Width = Unit.Percentage(25);
                tr.Controls.Add(td3);

                TableCell tdLN = new TableCell();
                tdLN.Text = "LastName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdLN);

                TableCell td4 = new TableCell();
                TextBox txtLn = new TextBox();
                txtLn.MaxLength = 20;
                txtLn.CssClass = "lj_inp";
                //txtLn.Width = 110;
                txtLn.ID = "txtCLnInt" + i;

                td4.Controls.Add(txtLn);
                // td4.Width = Unit.Percentage(25);
                tr.Controls.Add(td4);

                TableCell tdBD = new TableCell();
                tdBD.Text = "DOB :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdBD);

                TableCell td5 = new TableCell();
                TextBox txtBirthDate = new TextBox();
                txtBirthDate.Attributes.Add("onchange", "javascript:InfantDate(this);");
                txtBirthDate.Attributes.Add("onkeyup", "javascript:Adddob(this);");
                txtBirthDate.CssClass = "lj_inp";
                txtBirthDate.Width = 110;
                txtBirthDate.ID = "txtCBirthDateInt" + i;
                txtBirthDate.AutoPostBack = true;
                txtBirthDate.Attributes.Add("OnTextChanged", "javascript:GetYears(" + txtBirthDate.Text + "," + DateTime.Now + ")");
                td5.Controls.Add(txtBirthDate);

                TableCell td32 = new TableCell();
                RequiredFieldValidator rfv32 = new RequiredFieldValidator();
                rfv32.ID = "rfv32" + i;
                rfv32.ControlToValidate = "txtCBirthDateInt" + i;
                rfv32.ErrorMessage = "Enter Date Of Birth";
                rfv32.Display = ValidatorDisplay.None;
                rfv32.ValidationGroup = "SubmitBook";
                td32.Controls.Add(rfv32);
                tr.Controls.Add(td32);

                TableCell td33 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName33 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName33.ID = "vceCFirstName33" + i;
                vceCFirstName33.TargetControlID = "rfv32" + i;

                td32.Controls.Add(vceCFirstName33);
                tr.Controls.Add(td33);

                Label lblBirthDate = new Label();
                lblBirthDate.ID = "lblCBirthDateInt" + i;
                lblBirthDate.Text = "eg : 20-Oct-2012";

                td5.Controls.Add(lblBirthDate);
                tr.Controls.Add(td5);

                TableCell td6 = new TableCell();
                AjaxControlToolkit.CalendarExtender calExtChild = new AjaxControlToolkit.CalendarExtender();
                calExtChild.ID = "calExtChild" + i;
                calExtChild.TargetControlID = "txtCBirthDateInt" + i;
                calExtChild.Format = "dd-MMM-yyyy";
                td6.Controls.Add(calExtChild);
                tr.Controls.Add(td6);

                TableCell td7 = new TableCell();
                RequiredFieldValidator rfv7 = new RequiredFieldValidator();
                rfv7.ID = "rfv7" + i;
                rfv7.ControlToValidate = "txtCLnInt" + i;
                rfv7.ErrorMessage = "Enter Last Name";
                rfv7.Display = ValidatorDisplay.None;
                rfv7.ValidationGroup = "SubmitBook";
                td7.Controls.Add(rfv7);
                tr.Controls.Add(td7);

                TableCell td15 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender ftec2 = new AjaxControlToolkit.FilteredTextBoxExtender();
                ftec2.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                ftec2.TargetControlID = "txtCLnInt" + i;
                td15.Controls.Add(ftec2);
                tr.Controls.Add(td15);

                TableCell td16 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName2 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName2.ID = "vceCFirstName2" + i;
                vceCFirstName2.TargetControlID = "rfv7" + i;

                td7.Controls.Add(vceCFirstName2);
                tr.Controls.Add(td7);

                TableCell td8 = new TableCell();
                RequiredFieldValidator rfv8 = new RequiredFieldValidator();
                rfv8.ID = "rfv8" + i;
                rfv8.ControlToValidate = "txtCFnInt" + i;
                rfv8.ErrorMessage = "Enter First Name";
                rfv8.Display = ValidatorDisplay.None;
                rfv8.ValidationGroup = "SubmitBook";
                td8.Controls.Add(rfv8);
                tr.Controls.Add(td8);

                TableCell td13 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender ftec1 = new AjaxControlToolkit.FilteredTextBoxExtender();
                ftec1.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                ftec1.TargetControlID = "txtCFnInt" + i;
                td13.Controls.Add(ftec1);
                tr.Controls.Add(td13);

                TableCell td14 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName1.ID = "vceCFirstName1" + i;
                vceCFirstName1.TargetControlID = "rfv8" + i;

                td7.Controls.Add(vceCFirstName1);
                tr.Controls.Add(td7);

                tblChildInt.Controls.Add(tr);

            }

            for (int i = 1; i <= infCntInt; i++)
            {
                TableRow tr = new TableRow();
                TableCell td1 = new TableCell();
                td1.Text = "Infant" + i;
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(td1);

                TableCell tdSp = new TableCell();
                tdSp.Text = "";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdSp);

                TableCell tdtitle = new TableCell();
                tdtitle.Text = "Title :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdtitle);

                TableCell td2 = new TableCell();
                DropDownList ddlTitle = new DropDownList();
                ddlTitle.CssClass = "lj_inp";
                ddlTitle.ID = "ddlITitleInt" + i;
                ddlTitle.Items.Add("Mstr.");
                ddlTitle.Items.Add("Miss.");
                ddlTitle.Width = 55;
                td2.Controls.Add(ddlTitle);
                //td2.Width = Unit.Percentage(25);
                tr.Controls.Add(td2);

                TableCell tdFN = new TableCell();
                tdFN.Text = "FirstName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdFN);

                TableCell td3 = new TableCell();
                TextBox txtFn = new TextBox();
                txtFn.MaxLength = 20;
                txtFn.CssClass = "lj_inp";
                // txtFn.Width = 110;
                txtFn.ID = "txtIFnInt" + i;
                td3.Controls.Add(txtFn);
                // td3.Width = Unit.Percentage(25);
                tr.Controls.Add(td3);

                TableCell tdLN = new TableCell();
                tdLN.Text = "LastName :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdLN);

                TableCell td4 = new TableCell();
                TextBox txtLn = new TextBox();
                txtLn.MaxLength = 20;
                txtLn.CssClass = "lj_inp";
                //txtLn.Width = 110;
                txtLn.ID = "txtILn" + i;
                td4.Controls.Add(txtLn);
                // td4.Width = Unit.Percentage(25);
                tr.Controls.Add(td4);

                TableCell tdBD = new TableCell();
                tdBD.Text = "DOB :";
                // td1.Width = Unit.Percentage(25);
                tr.Controls.Add(tdBD);

                TableCell td5 = new TableCell();
                TextBox txtBirthDate = new TextBox();
                txtBirthDate.Attributes.Add("onchange", "javascript:InfantDate(this);");
                txtBirthDate.Attributes.Add("onkeyup", "javascript:Adddob(this);");
                txtBirthDate.CssClass = "lj_inp";
                txtBirthDate.Width = 110;
                txtBirthDate.ID = "txtIBirthDate" + i;

                td5.Controls.Add(txtBirthDate);

                TableCell td30 = new TableCell();
                RequiredFieldValidator rfv30 = new RequiredFieldValidator();
                rfv30.ID = "rfv30" + i;
                rfv30.ControlToValidate = "txtIBirthDate" + i;
                rfv30.ErrorMessage = "Enter Date Of Birth";
                rfv30.Display = ValidatorDisplay.None;
                rfv30.ValidationGroup = "SubmitBook";
                td30.Controls.Add(rfv30);
                tr.Controls.Add(td30);

                TableCell td31 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceCFirstName31 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceCFirstName31.ID = "vceCFirstName31" + i;
                vceCFirstName31.TargetControlID = "rfv30" + i;

                td31.Controls.Add(vceCFirstName31);
                tr.Controls.Add(td31);

                Label lblBirthDate = new Label();
                lblBirthDate.ID = "lblIBirthDate" + i;
                lblBirthDate.Text = " eg : 20-Oct-2012";
                td5.Controls.Add(lblBirthDate);

                tr.Controls.Add(td5);
                // txtBirthDate.Attributes.Add("onkeypress", "javascript:return false");

                TableCell td6 = new TableCell();
                AjaxControlToolkit.CalendarExtender calExtInf = new AjaxControlToolkit.CalendarExtender();
                calExtInf.ID = "calExtInf" + i;
                calExtInf.TargetControlID = "txtIBirthDate" + i;
                calExtInf.Format = "dd-MMM-yyyy";
                td6.Controls.Add(calExtInf);
                tr.Controls.Add(td6);

                TableCell td7 = new TableCell();
                RequiredFieldValidator rfv9 = new RequiredFieldValidator();
                rfv9.ID = "rfv9" + i;
                rfv9.ControlToValidate = "txtILn" + i;
                rfv9.ErrorMessage = "Enter Last Name";
                rfv9.Display = ValidatorDisplay.None;
                rfv9.ValidationGroup = "SubmitBook";
                td7.Controls.Add(rfv9);
                tr.Controls.Add(td7);

                TableCell td9 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fteIc1 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fteIc1.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                fteIc1.TargetControlID = "txtILn" + i;
                td9.Controls.Add(fteIc1);
                tr.Controls.Add(td9);

                TableCell td10 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceIFirstName1 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceIFirstName1.ID = "vceIFirstName1" + i;
                vceIFirstName1.TargetControlID = "rfv9" + i;

                td7.Controls.Add(vceIFirstName1);
                tr.Controls.Add(td10);

                TableCell td8 = new TableCell();
                RequiredFieldValidator rfv10 = new RequiredFieldValidator();
                rfv10.ID = "rfv10" + i;
                rfv10.ControlToValidate = "txtIFnInt" + i;
                rfv10.ErrorMessage = "Enter First Name";
                rfv10.Display = ValidatorDisplay.None;
                rfv10.ValidationGroup = "SubmitBook";
                td8.Controls.Add(rfv10);
                tr.Controls.Add(td8);

                TableCell td11 = new TableCell();
                AjaxControlToolkit.FilteredTextBoxExtender fteIc2 = new AjaxControlToolkit.FilteredTextBoxExtender();
                fteIc2.ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
                fteIc2.TargetControlID = "txtIFnInt" + i;
                td9.Controls.Add(fteIc2);
                tr.Controls.Add(td11);

                TableCell td12 = new TableCell();
                AjaxControlToolkit.ValidatorCalloutExtender vceIFirstName2 = new AjaxControlToolkit.ValidatorCalloutExtender();
                vceIFirstName2.ID = "vceIFirstName2" + i;
                vceIFirstName1.TargetControlID = "rfv10" + i;

                td7.Controls.Add(vceIFirstName1);
                tr.Controls.Add(td10);

                tblInfantsInt.Controls.Add(tr);

            }
            #endregion

        }
        catch
        {
        }

        #endregion
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        SuperForm1 = new SuperForm();
        SuperForm1.ID = "SuperForm1";
        SuperForm1.DataSourceID = "SqlDataSource1";
        SuperForm1.AutoGenerateRows = false;
        SuperForm1.AutoGenerateInsertButton = true;
        SuperForm1.AutoGenerateEditButton = true;
        SuperForm1.AutoGenerateDeleteButton = true;
        SuperForm1.DataKeyNames = new string[] { "EmployeeID" };
        SuperForm1.AllowPaging = true;
             
        SuperForm1.ValidationGroup = "Group1";
        SuperForm1.DefaultMode = DetailsViewMode.Insert;
        SuperForm1.ItemCommand += SuperForm1_ItemCommand;

        Obout.SuperForm.BoundField field1 = new Obout.SuperForm.BoundField();
        field1.DataField = "EmployeeID";
        field1.HeaderText = "Employee ID";
        field1.ReadOnly = true;
        field1.InsertVisible = false;

        RequiredFieldValidator field2Required = new RequiredFieldValidator();
        field2Required.ID = "FirstNameValidator";
        field2Required.Display = ValidatorDisplay.None;
        field2Required.ErrorMessage = "First Name is mandatory";

        ValidatorCalloutExtender field2CalloutExtender = new ValidatorCalloutExtender();
        field2CalloutExtender.ID = "FirstNameValidatorCallout";
        field2CalloutExtender.TargetControlID = "FirstNameValidator";
        field2CalloutExtender.Width = 250;
        field2CalloutExtender.HighlightCssClass = "highlight";
        field2CalloutExtender.WarningIconImageUrl = "resources/icons/warning.gif";
        field2CalloutExtender.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.BoundField field2 = new Obout.SuperForm.BoundField();
        field2.DataField = "FirstName";
        field2.HeaderText = "First Name";
        field2.Validators.Add(field2Required);
        field2.Validators.Add(field2CalloutExtender);

        RequiredFieldValidator field3Required = new RequiredFieldValidator();
        field3Required.ID = "LastNameValidator";
        field3Required.Display = ValidatorDisplay.None;
        field3Required.ErrorMessage = "Last Name is mandatory";
        field3Required.Text = "*";

        ValidatorCalloutExtender field3CalloutExtender = new ValidatorCalloutExtender();
        field3CalloutExtender.ID = "LastNameValidatorCallout";
        field3CalloutExtender.TargetControlID = "LastNameValidator";
        field3CalloutExtender.Width = 250;
        field3CalloutExtender.HighlightCssClass = "highlight";
        field3CalloutExtender.WarningIconImageUrl = "resources/icons/warning.gif";
        field3CalloutExtender.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.BoundField field3 = new Obout.SuperForm.BoundField();
        field3.DataField = "LastName";
        field3.HeaderText = "Last Name";
        field3.Validators.Add(field3Required);
        field3.Validators.Add(field3CalloutExtender);

        RequiredFieldValidator field4Required = new RequiredFieldValidator();
        field4Required.ID = "TitleOfCourtesyValidator1";
        field4Required.Display = ValidatorDisplay.None;
        field4Required.ErrorMessage = "Courtesy Title is mandatory";
        field4Required.Text = "*";

        ValidatorCalloutExtender field4Callout1 = new ValidatorCalloutExtender();
        field4Callout1.ID = "TitleOfCourtesyValidatorCallout1";
        field4Callout1.TargetControlID = "TitleOfCourtesyValidator1";
        field4Callout1.Width = 250;
        field4Callout1.HighlightCssClass = "highlight";
        field4Callout1.WarningIconImageUrl = "resources/icons/warning.gif";
        field4Callout1.CloseImageUrl = "resources/icons/close.gif";

        CustomValidator field4Custom = new CustomValidator();
        field4Custom.ID = "TitleOfCourtesyValidator2";
        field4Custom.ServerValidate += ValidateTitle;
        field4Custom.Display = ValidatorDisplay.Dynamic;
        field4Custom.ErrorMessage = "Courtesy Title needs to be 'Mr.', 'Ms.', 'Mrs.' or 'Dr.'";
        field4Custom.Text = "Courtesy Title needs to be 'Mr.', 'Ms.', 'Mrs.' or 'Dr.'";

        Obout.SuperForm.BoundField field4 = new Obout.SuperForm.BoundField();
        field4.DataField = "TitleOfCourtesy";
        field4.HeaderText = "Courtesy Title";
        field4.Validators.Add(field4Required);
        field4.Validators.Add(field4Callout1);
        field4.Validators.Add(field4Custom);

        RequiredFieldValidator field5Required = new RequiredFieldValidator();
        field5Required.ID = "BirthDateValidator1";
        field5Required.Display = ValidatorDisplay.None;
        field5Required.ErrorMessage = "Birth Date is mandatory";
        field5Required.Text = "*";

        ValidatorCalloutExtender field5Callout1 = new ValidatorCalloutExtender();
        field5Callout1.ID = "BirthDateValidatorCallout1";
        field5Callout1.TargetControlID = "BirthDateValidator1";
        field5Callout1.Width = 250;
        field5Callout1.HighlightCssClass = "highlight";
        field5Callout1.WarningIconImageUrl = "resources/icons/warning.gif";
        field5Callout1.CloseImageUrl = "resources/icons/close.gif";

        RangeValidator field5Range = new RangeValidator();
        field5Range.ID = "BirthDateValidator2";
        field5Range.Display = ValidatorDisplay.None;
        field5Range.MinimumValue = "1900/1/1";
        field5Range.MaximumValue = "2039/12/31";
        field5Range.Type = ValidationDataType.Date;
        field5Range.ErrorMessage = "Birth Date needs to be in this format: mm/dd/yyyy";
        field5Range.Text = "*";

        ValidatorCalloutExtender field5Callout2 = new ValidatorCalloutExtender();
        field5Callout2.ID = "BirthDateValidatorCallout2";
        field5Callout2.TargetControlID = "BirthDateValidator2";
        field5Callout2.Width = 250;
        field5Callout2.HighlightCssClass = "highlight";
        field5Callout2.WarningIconImageUrl = "resources/icons/warning.gif";
        field5Callout2.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.DateField field5 = new Obout.SuperForm.DateField();
        field5.DataField = "BirthDate";
        field5.HeaderText = "Birth Date";
        field5.DataFormatString = "{0:MM/dd/yyyy}";
        field5.ApplyFormatInEditMode = true;
        field5.Validators.Add(field5Required);
        field5.Validators.Add(field5Callout1);
        field5.Validators.Add(field5Range);
        field5.Validators.Add(field5Callout2);

        RequiredFieldValidator field6Required = new RequiredFieldValidator();
        field6Required.ID = "HomePhoneValidator1";
        field6Required.Display = ValidatorDisplay.None;
        field6Required.ErrorMessage = "Home Phone is mandatory";
        field6Required.Text = "*";

        ValidatorCalloutExtender field6Callout1 = new ValidatorCalloutExtender();
        field6Callout1.ID = "HomePhoneValidatorCallout1";
        field6Callout1.TargetControlID = "HomePhoneValidator1";
        field6Callout1.Width = 250;
        field6Callout1.HighlightCssClass = "highlight";
        field6Callout1.WarningIconImageUrl = "resources/icons/warning.gif";
        field6Callout1.CloseImageUrl = "resources/icons/close.gif";

        RegularExpressionValidator field6Range = new RegularExpressionValidator();
        field6Range.ID = "HomePhoneValidator2";
        field6Range.Display = ValidatorDisplay.None;
        field6Range.ValidationExpression = "^(\\(?\\s*\\d{3}\\s*[\\)\\-\\.]?\\s*)?[1-9]\\d{2}\\s*[\\-\\.]\\s*\\d{4}$";
        field6Range.ErrorMessage = "Home Phone must be in this format (###) ###-####";
        field6Range.Text = "*";

        ValidatorCalloutExtender field6Callout2 = new ValidatorCalloutExtender();
        field6Callout2.ID = "HomePhoneValidatorCallout2";
        field6Callout2.TargetControlID = "HomePhoneValidator2";
        field6Callout2.Width = 250;
        field6Callout2.HighlightCssClass = "highlight";
        field6Callout2.WarningIconImageUrl = "resources/icons/warning.gif";
        field6Callout2.CloseImageUrl = "resources/icons/close.gif";

        Obout.SuperForm.BoundField field6 = new Obout.SuperForm.BoundField();
        field6.DataField = "HomePhone";
        field6.HeaderText = "Home Phone";
        field6.Validators.Add(field6Required);
        field6.Validators.Add(field6Callout1);
        field6.Validators.Add(field6Range);
        field6.Validators.Add(field6Callout2);

        SuperForm1.Fields.Add(field1);
        SuperForm1.Fields.Add(field2);
        SuperForm1.Fields.Add(field3);
        SuperForm1.Fields.Add(field4);
        SuperForm1.Fields.Add(field5);
        SuperForm1.Fields.Add(field6);

        SuperForm1Container.Controls.Add(SuperForm1);
    }
Ejemplo n.º 3
0
    private void LoadGMCommandTemplate()
    {
        int textBoxCount   = 100;
        int validatorCount = 100;

        TableCell templateTableCell = this.TemplateTable.FindControl("TemplateTableCell") as TableCell;

        XPathNavigator nav;
        XPathDocument  docNav;

        docNav = new XPathDocument(WebConfig.WebsiteRootPath + "GMCommandTemplate.xml");
        nav    = docNav.CreateNavigator();
        nav.MoveToRoot();
        nav.MoveToFirstChild();

        while (nav.NodeType != XPathNodeType.Element)
        {
            nav.MoveToNext();
        }

        if (nav.LocalName != "GMCommandTemplates")
        {
            throw new Exception("根结点必须为&lt;GMCommandTemplates&gt;");
        }

        if (nav.HasChildren)
        {
            nav.MoveToFirstChild();
        }
        else
        {
            throw new Exception("&lt;GMCommandTemplates&gt;下必须有子结点");
        }

        do
        {
            if (nav.NodeType == XPathNodeType.Element)
            {
                if (nav.LocalName != "Template")
                {
                    throw new Exception("&lt;GMCommandTemplates&gt;下的子结点只允许为&lt;Template&gt;");
                }

                if (nav.HasChildren)
                {
                    nav.MoveToFirstChild();

                    GMCommandTemplate template = new GMCommandTemplate();

                    Panel panel = new Panel();
                    Table table = new Table();

                    string templateName = String.Empty;
                    string cmd          = String.Empty;

                    Label desLabel = new Label();
                    panel.Controls.Add(desLabel);

                    do
                    {
                        if (nav.LocalName == "TemplateName")
                        {
                            templateName = nav.Value;
                            if (IsPostBack == false)
                            {
                                ListBoxOperation.Items.Add(new ListItem(templateName));
                            }
                        }
                        else if (nav.LocalName == "Executer")
                        {
                            if ((nav.Value == "Role") || (nav.Value == "Account"))
                            {
                                TableRow row = new TableRow();
                                row.HorizontalAlign = HorizontalAlign.Center;
                                TableCell[] cell = new TableCell[2];
                                for (int i = 0; i < 2; i++)
                                {
                                    cell[i] = new TableCell();
                                }

                                cell[0].Width       = new Unit(20f, UnitType.Percentage);
                                cell[0].Style.Value = "text-align: center;font-weight: bold;color: #FFFFFF;background-color: #5099B3;height: 20px;border-bottom: solid 1px #808080;border-right: solid 1px #808080;";

                                //Role和Account唯一不同的地方
                                if (nav.Value == "Role")
                                {
                                    cell[0].Text           = "角色名";
                                    template.isAccountName = false;
                                }
                                else
                                {
                                    cell[0].Text           = "账号名";
                                    template.isAccountName = true;
                                }

                                cell[1].Width = new Unit(80f, UnitType.Percentage);

                                TextBox textBox = new TextBox();
                                textBox.ID = "textBox" + textBoxCount.ToString();
                                textBoxCount++;
                                cell[1].Controls.Add(textBox);
                                template.PlayerNameTextBox = textBox;

                                //必须有输入,RequiredFieldValidator
                                RequiredFieldValidator validator = new RequiredFieldValidator();
                                validator.ID = "validator" + validatorCount.ToString();
                                validatorCount++;
                                validator.ControlToValidate = textBox.ID;
                                validator.Display           = ValidatorDisplay.None;
                                validator.ErrorMessage      = StringDef.RequiredFieldValidatorErrorMsg;
                                validator.SetFocusOnError   = true;
                                cell[1].Controls.Add(validator);
                                AjaxControlToolkit.ValidatorCalloutExtender validatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                validatorExtender.TargetControlID = validator.ID;
                                cell[1].Controls.Add(validatorExtender);

                                row.Cells.AddRange(cell);
                                table.Rows.Add(row);
                            }
                            else if (nav.Value == "GameCenter")
                            {
                                //不生成任何控件,什么也不做,只是保证"GameCenter"为合法的值
                            }
                            else
                            {
                                throw new Exception("&lt;Executer&gt;的值" + nav.Value + "不合法,合法的值为Role,Account或GameCenter");
                            }
                        }
                        else if (nav.LocalName == "TemplateCMD")
                        {
                            cmd = nav.Value;
                        }
                        else if (nav.LocalName == "Description")
                        {
                            desLabel.Text = nav.Value + "<br />&nbsp;";
                        }
                        else if (nav.LocalName == "Parameter")
                        {
                            if (nav.HasChildren)
                            {
                                nav.MoveToFirstChild();

                                if (nav.LocalName == "Name")
                                {
                                    TableRow row = new TableRow();
                                    row.HorizontalAlign = HorizontalAlign.Center;
                                    TableCell[] cell = new TableCell[2];
                                    for (int i = 0; i < 2; i++)
                                    {
                                        cell[i] = new TableCell();
                                    }

                                    cell[0].Width       = new Unit(20f, UnitType.Percentage);
                                    cell[0].Style.Value = "text-align: center;font-weight: bold;color: #FFFFFF;background-color: #5099B3;height: 20px;border-bottom: solid 1px #808080;border-right: solid 1px #808080;";
                                    cell[0].Text        = nav.Value;
                                    cell[1].Width       = new Unit(80f, UnitType.Percentage);

                                    if (nav.MoveToNext())
                                    {
                                        if (nav.LocalName == "Control")
                                        {
                                            if (nav.HasChildren)
                                            {
                                                nav.MoveToFirstChild();

                                                if (nav.LocalName == "Type")
                                                {
                                                    switch (nav.Value)
                                                    {
                                                    case "TextBox":
                                                        TextBox textBox = new TextBox();
                                                        textBox.ID = "textBox" + textBoxCount.ToString();
                                                        textBoxCount++;
                                                        cell[1].Controls.Add(textBox);
                                                        template.ControlList.Add(textBox);

                                                        //必须有输入,RequiredFieldValidator
                                                        RequiredFieldValidator validator = new RequiredFieldValidator();
                                                        validator.ID = "validator" + validatorCount.ToString();
                                                        validatorCount++;
                                                        validator.ControlToValidate = textBox.ID;
                                                        validator.Display           = ValidatorDisplay.None;
                                                        validator.ErrorMessage      = StringDef.RequiredFieldValidatorErrorMsg;
                                                        validator.SetFocusOnError   = true;
                                                        cell[1].Controls.Add(validator);
                                                        AjaxControlToolkit.ValidatorCalloutExtender validatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                        validatorExtender.TargetControlID = validator.ID;
                                                        cell[1].Controls.Add(validatorExtender);

                                                        //TextBox类型可能有的其他特性定义
                                                        while (nav.MoveToNext())
                                                        {
                                                            if (nav.LocalName == "MultiLine")
                                                            {
                                                                if (nav.Value == "True")
                                                                {
                                                                    textBox.TextMode = TextBoxMode.MultiLine;
                                                                    textBox.Wrap     = true;
                                                                }
                                                            }
                                                            else if (nav.LocalName == "MaxCharCount")
                                                            {
                                                                if (textBox.TextMode == TextBoxMode.MultiLine)
                                                                {
                                                                    textBox.Attributes.Add("onkeypress", "return validateMaxLength(this, " + nav.Value + ");");
                                                                    textBox.Attributes.Add("onbeforepaste", "doBeforePaste(this, " + nav.Value + ");");
                                                                    textBox.Attributes.Add("onpaste", "doPaste(this, " + nav.Value + ");");
                                                                }
                                                                else
                                                                {
                                                                    textBox.MaxLength = int.Parse(nav.Value);
                                                                }
                                                            }
                                                            else if (nav.LocalName == "Style")
                                                            {
                                                                textBox.Style.Value = nav.Value;
                                                            }
                                                        }
                                                        break;

                                                    case "IntegerTextBox":
                                                        TextBox integerTextBox = new TextBox();
                                                        integerTextBox.ID = "textBox" + textBoxCount.ToString();
                                                        textBoxCount++;
                                                        cell[1].Controls.Add(integerTextBox);
                                                        template.ControlList.Add(integerTextBox);

                                                        //必须有输入,RequiredFieldValidator
                                                        RequiredFieldValidator integerValidator = new RequiredFieldValidator();
                                                        integerValidator.ID = "validator" + validatorCount.ToString();
                                                        validatorCount++;
                                                        integerValidator.ControlToValidate = integerTextBox.ID;
                                                        integerValidator.Display           = ValidatorDisplay.None;
                                                        integerValidator.ErrorMessage      = StringDef.RequiredFieldValidatorErrorMsg;
                                                        integerValidator.SetFocusOnError   = true;
                                                        cell[1].Controls.Add(integerValidator);
                                                        AjaxControlToolkit.ValidatorCalloutExtender integerValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                        integerValidatorExtender.TargetControlID = integerValidator.ID;
                                                        cell[1].Controls.Add(integerValidatorExtender);

                                                        //IntegerTextBox类型,用CompareValidator限定只能输入整数,
                                                        CompareValidator compareValidator = new CompareValidator();
                                                        compareValidator.ID = "validator" + validatorCount.ToString();
                                                        validatorCount++;
                                                        compareValidator.ControlToValidate = integerTextBox.ID;
                                                        compareValidator.Display           = ValidatorDisplay.None;
                                                        compareValidator.ErrorMessage      = "必须填写整数";
                                                        compareValidator.SetFocusOnError   = true;
                                                        compareValidator.Operator          = ValidationCompareOperator.DataTypeCheck;
                                                        compareValidator.Type = ValidationDataType.Integer;
                                                        cell[1].Controls.Add(compareValidator);
                                                        AjaxControlToolkit.ValidatorCalloutExtender compareValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                        compareValidatorExtender.TargetControlID = compareValidator.ID;
                                                        cell[1].Controls.Add(compareValidatorExtender);

                                                        //IntegerTextBox类型可能有的其他特性定义
                                                        while (nav.MoveToNext())
                                                        {
                                                            //用CompareValidator限定值必须大于等于MinValue
                                                            if (nav.LocalName == "MinValue")
                                                            {
                                                                string minValue = nav.Value;

                                                                CompareValidator minValidator = new CompareValidator();
                                                                minValidator.ID = "validator" + validatorCount.ToString();
                                                                validatorCount++;
                                                                minValidator.ControlToValidate = integerTextBox.ID;
                                                                minValidator.Display           = ValidatorDisplay.None;
                                                                minValidator.ErrorMessage      = "输入的值必须大于等于" + minValue;
                                                                minValidator.SetFocusOnError   = true;
                                                                minValidator.Operator          = ValidationCompareOperator.GreaterThanEqual;
                                                                minValidator.Type           = ValidationDataType.Integer;
                                                                minValidator.ValueToCompare = minValue;
                                                                cell[1].Controls.Add(minValidator);
                                                                AjaxControlToolkit.ValidatorCalloutExtender minValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                                minValidatorExtender.TargetControlID = minValidator.ID;
                                                                cell[1].Controls.Add(minValidatorExtender);
                                                            }

                                                            //用CompareValidator限定值必须小于等于MaxValue
                                                            else if (nav.LocalName == "MaxValue")
                                                            {
                                                                string maxValue = nav.Value;

                                                                CompareValidator maxValidator = new CompareValidator();
                                                                maxValidator.ID = "validator" + validatorCount.ToString();
                                                                validatorCount++;
                                                                maxValidator.ControlToValidate = integerTextBox.ID;
                                                                maxValidator.Display           = ValidatorDisplay.None;
                                                                maxValidator.ErrorMessage      = "输入的值必须小于等于" + maxValue;
                                                                maxValidator.SetFocusOnError   = true;
                                                                maxValidator.Operator          = ValidationCompareOperator.LessThanEqual;
                                                                maxValidator.Type           = ValidationDataType.Integer;
                                                                maxValidator.ValueToCompare = maxValue;
                                                                cell[1].Controls.Add(maxValidator);
                                                                AjaxControlToolkit.ValidatorCalloutExtender maxValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                                maxValidatorExtender.TargetControlID = maxValidator.ID;
                                                                cell[1].Controls.Add(maxValidatorExtender);
                                                            }
                                                            else if (nav.LocalName == "Style")
                                                            {
                                                                integerTextBox.Style.Value = nav.Value;
                                                            }
                                                        }
                                                        break;

                                                    case "DropDownList":
                                                        DropDownList dropDownList = new DropDownList();
                                                        cell[1].Controls.Add(dropDownList);
                                                        template.ControlList.Add(dropDownList);

                                                        while (nav.MoveToNext())
                                                        {
                                                            if (nav.LocalName == "Style")
                                                            {
                                                                dropDownList.Style.Value = nav.Value;
                                                            }

                                                            //添加dropDownList具有的Item
                                                            else if (nav.LocalName == "Item")
                                                            {
                                                                if (nav.HasChildren)
                                                                {
                                                                    nav.MoveToFirstChild();

                                                                    ListItem item = new ListItem();

                                                                    do
                                                                    {
                                                                        if (nav.LocalName == "Text")
                                                                        {
                                                                            item.Text = nav.Value;
                                                                        }
                                                                        else if (nav.LocalName == "Value")
                                                                        {
                                                                            item.Value = nav.Value;
                                                                        }
                                                                    }while (nav.MoveToNext());

                                                                    if ((item.Text != String.Empty) && (item.Value != String.Empty))
                                                                    {
                                                                        dropDownList.Items.Add(item);
                                                                    }

                                                                    nav.MoveToParent();
                                                                }
                                                            }
                                                        }
                                                        break;

                                                    default:
                                                        throw new Exception("&lt;Type&gt;的值" + nav.Value + "不合法,合法的值为TextBox,IntegerTextBox或DropDownList");
                                                    }
                                                }

                                                nav.MoveToParent();
                                            }
                                            else
                                            {
                                                throw new Exception("&lt;Control&gt;下必须有子结点");
                                            }
                                        }
                                        else
                                        {
                                            throw new Exception("&lt;Name&gt;后的结点只能为&lt;Control&gt;");
                                        }
                                    }
                                    else
                                    {
                                        throw new Exception("&lt;Parameter&gt;下不能只有&lt;Name&gt;结点");
                                    }

                                    row.Cells.AddRange(cell);
                                    table.Rows.Add(row);
                                }
                                else
                                {
                                    throw new Exception("&lt;Parameter&gt;下的第一个结点必须为&lt;Name&gt;");
                                }

                                nav.MoveToParent();
                            }
                            else
                            {
                                throw new Exception("&lt;Parameter&gt;下必须有子结点");
                            }
                        }
                        else
                        {
                            throw new Exception("结点&lt;" + nav.LocalName + "&gt;不合法");
                        }
                    }while (nav.MoveToNext());

                    panel.Controls.Add(table);

                    Button button = new Button();
                    button.Text          = templateName;
                    button.CommandName   = templateList.Count.ToString();
                    button.Click        += new EventHandler(Button_Click);
                    button.OnClientClick = "if (Page_ClientValidate()){return window.confirm('确认执行GM指令吗?');}";
                    panel.Controls.Add(button);

                    templateTableCell.Controls.Add(panel);

                    template.TemplatePanel = panel;
                    template.cmd           = cmd;

                    templateList.Add(template);

                    nav.MoveToParent();
                }
                else
                {
                    throw new Exception("&lt;Template&gt;下必须有子结点");
                }
            }
        }while (nav.MoveToNext());

        if (IsPostBack == false)
        {
            ListBoxOperation.SelectedIndex = 0;
        }

        SetPanelVisible();
    }
    private void CargarValidadorPersonalCitado(Label labelControl, RangeValidator validadorRango, ValidatorCalloutExtender validadorCallout)
    {
        Decimal ID_EMPRESA = Convert.ToDecimal(HiddenField_ID_EMPRESA.Value);

        cliente _cliente = new cliente(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString());
        DataTable tablaDatos = _cliente.ObtenerNumEmpleadosActivosPorIdEmpresa(ID_EMPRESA, "S", "S");

        if (tablaDatos.Rows.Count <= 0)
        {
            if (_cliente.MensajeError != null)
            {
                Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "No se pudo determinar el personal activo actual de la empresa, no se realizará el control de personal.", Proceso.Advertencia);
            }

            labelControl.Visible = false;
            validadorRango.Enabled = false;
            validadorCallout.Enabled = false;

        }
        else
        {
            Int32 contadorPersonalActivo = Convert.ToInt32(tablaDatos.Rows[0]["NUM_EMPLEADOS"]);

            if (contadorPersonalActivo <= 0)
            {
                Informar(Panel_FONDO_MENSAJE, Image_MENSAJE_POPUP, Panel_MENSAJES, Label_MENSAJE, "La empresa no tiene personal activo, no se realizará el control de personal.", Proceso.Advertencia);

                labelControl.Visible = false;
                validadorRango.Enabled = false;
                validadorCallout.Enabled = false;
            }
            else
            {
                labelControl.Visible = true;
                labelControl.Text = contadorPersonalActivo.ToString();
                validadorRango.Enabled = true;
                validadorCallout.Enabled = true;

                validadorRango.MinimumValue = "1";
                validadorRango.MaximumValue = contadorPersonalActivo.ToString();
            }
        }
    }
Ejemplo n.º 5
0
    private void LoadGMCommandTemplate()
    {
        int textBoxCount = 100;
        int validatorCount = 100;
        
        TableCell templateTableCell = this.TemplateTable.FindControl("TemplateTableCell") as TableCell;

        XPathNavigator nav;
        XPathDocument docNav;

        docNav = new XPathDocument(WebConfig.WebsiteRootPath + "GMCommandTemplate.xml");
        nav = docNav.CreateNavigator();
        nav.MoveToRoot();
        nav.MoveToFirstChild();

        while (nav.NodeType != XPathNodeType.Element)
            nav.MoveToNext();

        if (nav.LocalName != "GMCommandTemplates")
            throw new Exception("根结点必须为&lt;GMCommandTemplates&gt;");

        if (nav.HasChildren)
            nav.MoveToFirstChild();
        else
            throw new Exception("&lt;GMCommandTemplates&gt;下必须有子结点");

        do
        {
            if (nav.NodeType == XPathNodeType.Element)
            {
                if (nav.LocalName != "Template")
                    throw new Exception("&lt;GMCommandTemplates&gt;下的子结点只允许为&lt;Template&gt;");

                if (nav.HasChildren)
                {
                    nav.MoveToFirstChild();

                    GMCommandTemplate template = new GMCommandTemplate();

                    Panel panel = new Panel();
                    Table table = new Table();

                    string templateName = String.Empty;
                    string cmd = String.Empty;
                    
                    Label desLabel = new Label();                    
                    panel.Controls.Add(desLabel);

                    do
                    {
                        if (nav.LocalName == "TemplateName")
                        {
                            templateName = nav.Value;
                            if (IsPostBack == false)
                                ListBoxOperation.Items.Add(new ListItem(templateName));
                        }
                        else if (nav.LocalName == "Executer")
                        {
                            if ((nav.Value == "Role") || (nav.Value == "Account"))
                            {
                                TableRow row = new TableRow();
                                row.HorizontalAlign = HorizontalAlign.Center;
                                TableCell[] cell = new TableCell[2];
                                for (int i = 0; i < 2; i++)
                                    cell[i] = new TableCell();

                                cell[0].Width = new Unit(20f, UnitType.Percentage);
                                cell[0].Style.Value = "text-align: center;font-weight: bold;color: #FFFFFF;background-color: #5099B3;height: 20px;border-bottom: solid 1px #808080;border-right: solid 1px #808080;";

                                //Role和Account唯一不同的地方
                                if (nav.Value == "Role")
                                {
                                    cell[0].Text = "角色名";
                                    template.isAccountName = false;
                                }
                                else
                                {
                                    cell[0].Text = "账号名";
                                    template.isAccountName = true;
                                }

                                cell[1].Width = new Unit(80f, UnitType.Percentage);

                                TextBox textBox = new TextBox();
                                textBox.ID = "textBox" + textBoxCount.ToString();
                                textBoxCount++;
                                cell[1].Controls.Add(textBox);
                                template.PlayerNameTextBox = textBox;

                                //必须有输入,RequiredFieldValidator
                                RequiredFieldValidator validator = new RequiredFieldValidator();
                                validator.ID = "validator" + validatorCount.ToString();
                                validatorCount++;
                                validator.ControlToValidate = textBox.ID;
                                validator.Display = ValidatorDisplay.None;
                                validator.ErrorMessage = StringDef.RequiredFieldValidatorErrorMsg;
                                validator.SetFocusOnError = true;
                                cell[1].Controls.Add(validator);
                                AjaxControlToolkit.ValidatorCalloutExtender validatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                validatorExtender.TargetControlID = validator.ID;
                                cell[1].Controls.Add(validatorExtender);

                                row.Cells.AddRange(cell);
                                table.Rows.Add(row);
                            }
                            else if (nav.Value == "GameCenter")
                            {
                                //不生成任何控件,什么也不做,只是保证"GameCenter"为合法的值
                            }
                            else
                                throw new Exception("&lt;Executer&gt;的值" + nav.Value + "不合法,合法的值为Role,Account或GameCenter");
                        }
                        else if (nav.LocalName == "TemplateCMD")
                        {
                            cmd = nav.Value;
                        }
                        else if (nav.LocalName == "Description")
                        {
                            desLabel.Text = nav.Value + "<br />&nbsp;";
                        }
                        else if (nav.LocalName == "Parameter")
                        {
                            if (nav.HasChildren)
                            {
                                nav.MoveToFirstChild();

                                if (nav.LocalName == "Name")
                                {
                                    TableRow row = new TableRow();
                                    row.HorizontalAlign = HorizontalAlign.Center;
                                    TableCell[] cell = new TableCell[2];
                                    for (int i = 0; i < 2; i++)
                                        cell[i] = new TableCell();

                                    cell[0].Width = new Unit(20f, UnitType.Percentage);
                                    cell[0].Style.Value = "text-align: center;font-weight: bold;color: #FFFFFF;background-color: #5099B3;height: 20px;border-bottom: solid 1px #808080;border-right: solid 1px #808080;";
                                    cell[0].Text = nav.Value;
                                    cell[1].Width = new Unit(80f, UnitType.Percentage);

                                    if (nav.MoveToNext())
                                    {
                                        if (nav.LocalName == "Control")
                                        {
                                            if (nav.HasChildren)
                                            {
                                                nav.MoveToFirstChild();

                                                if (nav.LocalName == "Type")
                                                {
                                                    switch (nav.Value)
                                                    {
                                                        case "TextBox":
                                                            TextBox textBox = new TextBox();
                                                            textBox.ID = "textBox" + textBoxCount.ToString();
                                                            textBoxCount++;
                                                            cell[1].Controls.Add(textBox);
                                                            template.ControlList.Add(textBox);

                                                            //必须有输入,RequiredFieldValidator
                                                            RequiredFieldValidator validator = new RequiredFieldValidator();
                                                            validator.ID = "validator" + validatorCount.ToString();
                                                            validatorCount++;
                                                            validator.ControlToValidate = textBox.ID;
                                                            validator.Display = ValidatorDisplay.None;
                                                            validator.ErrorMessage = StringDef.RequiredFieldValidatorErrorMsg;
                                                            validator.SetFocusOnError = true;
                                                            cell[1].Controls.Add(validator);
                                                            AjaxControlToolkit.ValidatorCalloutExtender validatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                            validatorExtender.TargetControlID = validator.ID;
                                                            cell[1].Controls.Add(validatorExtender);

                                                            //TextBox类型可能有的其他特性定义
                                                            while (nav.MoveToNext())
                                                            {
                                                                if (nav.LocalName == "MultiLine")
                                                                {
                                                                    if (nav.Value == "True")
                                                                    {
                                                                        textBox.TextMode = TextBoxMode.MultiLine;
                                                                        textBox.Wrap = true;
                                                                    }
                                                                }
                                                                else if (nav.LocalName == "MaxCharCount")
                                                                {
                                                                    if (textBox.TextMode == TextBoxMode.MultiLine)
                                                                    {
                                                                        textBox.Attributes.Add("onkeypress", "return validateMaxLength(this, " + nav.Value + ");");
                                                                        textBox.Attributes.Add("onbeforepaste", "doBeforePaste(this, " + nav.Value + ");");
                                                                        textBox.Attributes.Add("onpaste", "doPaste(this, " + nav.Value + ");");
                                                                    }
                                                                    else
                                                                        textBox.MaxLength = int.Parse(nav.Value);
                                                                }
                                                                else if (nav.LocalName == "Style")
                                                                    textBox.Style.Value = nav.Value;
                                                            }
                                                            break;

                                                        case "IntegerTextBox":
                                                            TextBox integerTextBox = new TextBox();
                                                            integerTextBox.ID = "textBox" + textBoxCount.ToString();
                                                            textBoxCount++;
                                                            cell[1].Controls.Add(integerTextBox);
                                                            template.ControlList.Add(integerTextBox);

                                                            //必须有输入,RequiredFieldValidator
                                                            RequiredFieldValidator integerValidator = new RequiredFieldValidator();
                                                            integerValidator.ID = "validator" + validatorCount.ToString();
                                                            validatorCount++;
                                                            integerValidator.ControlToValidate = integerTextBox.ID;
                                                            integerValidator.Display = ValidatorDisplay.None;
                                                            integerValidator.ErrorMessage = StringDef.RequiredFieldValidatorErrorMsg;
                                                            integerValidator.SetFocusOnError = true;
                                                            cell[1].Controls.Add(integerValidator);
                                                            AjaxControlToolkit.ValidatorCalloutExtender integerValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                            integerValidatorExtender.TargetControlID = integerValidator.ID;
                                                            cell[1].Controls.Add(integerValidatorExtender);

                                                            //IntegerTextBox类型,用CompareValidator限定只能输入整数,
                                                            CompareValidator compareValidator = new CompareValidator();
                                                            compareValidator.ID = "validator" + validatorCount.ToString();
                                                            validatorCount++;
                                                            compareValidator.ControlToValidate = integerTextBox.ID;
                                                            compareValidator.Display = ValidatorDisplay.None;
                                                            compareValidator.ErrorMessage = "必须填写整数";
                                                            compareValidator.SetFocusOnError = true;
                                                            compareValidator.Operator = ValidationCompareOperator.DataTypeCheck;
                                                            compareValidator.Type = ValidationDataType.Integer;
                                                            cell[1].Controls.Add(compareValidator);
                                                            AjaxControlToolkit.ValidatorCalloutExtender compareValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                            compareValidatorExtender.TargetControlID = compareValidator.ID;
                                                            cell[1].Controls.Add(compareValidatorExtender);

                                                            //IntegerTextBox类型可能有的其他特性定义
                                                            while (nav.MoveToNext())
                                                            {
                                                                //用CompareValidator限定值必须大于等于MinValue
                                                                if (nav.LocalName == "MinValue")
                                                                {
                                                                    string minValue = nav.Value;

                                                                    CompareValidator minValidator = new CompareValidator();
                                                                    minValidator.ID = "validator" + validatorCount.ToString();
                                                                    validatorCount++;
                                                                    minValidator.ControlToValidate = integerTextBox.ID;
                                                                    minValidator.Display = ValidatorDisplay.None;
                                                                    minValidator.ErrorMessage = "输入的值必须大于等于" + minValue;
                                                                    minValidator.SetFocusOnError = true;
                                                                    minValidator.Operator = ValidationCompareOperator.GreaterThanEqual;
                                                                    minValidator.Type = ValidationDataType.Integer;
                                                                    minValidator.ValueToCompare = minValue;
                                                                    cell[1].Controls.Add(minValidator);
                                                                    AjaxControlToolkit.ValidatorCalloutExtender minValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                                    minValidatorExtender.TargetControlID = minValidator.ID;
                                                                    cell[1].Controls.Add(minValidatorExtender);
                                                                }

                                                                //用CompareValidator限定值必须小于等于MaxValue
                                                                else if (nav.LocalName == "MaxValue")
                                                                {
                                                                    string maxValue = nav.Value;

                                                                    CompareValidator maxValidator = new CompareValidator();
                                                                    maxValidator.ID = "validator" + validatorCount.ToString();
                                                                    validatorCount++;
                                                                    maxValidator.ControlToValidate = integerTextBox.ID;
                                                                    maxValidator.Display = ValidatorDisplay.None;
                                                                    maxValidator.ErrorMessage = "输入的值必须小于等于" + maxValue;
                                                                    maxValidator.SetFocusOnError = true;
                                                                    maxValidator.Operator = ValidationCompareOperator.LessThanEqual;
                                                                    maxValidator.Type = ValidationDataType.Integer;
                                                                    maxValidator.ValueToCompare = maxValue;
                                                                    cell[1].Controls.Add(maxValidator);
                                                                    AjaxControlToolkit.ValidatorCalloutExtender maxValidatorExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
                                                                    maxValidatorExtender.TargetControlID = maxValidator.ID;
                                                                    cell[1].Controls.Add(maxValidatorExtender);
                                                                }
                                                                else if (nav.LocalName == "Style")
                                                                    integerTextBox.Style.Value = nav.Value;
                                                            }
                                                            break;

                                                        case "DropDownList":
                                                            DropDownList dropDownList = new DropDownList();
                                                            cell[1].Controls.Add(dropDownList);
                                                            template.ControlList.Add(dropDownList);

                                                            while (nav.MoveToNext())
                                                            {
                                                                if (nav.LocalName == "Style")
                                                                    dropDownList.Style.Value = nav.Value;

                                                                //添加dropDownList具有的Item
                                                                else if (nav.LocalName == "Item")
                                                                {
                                                                    if (nav.HasChildren)
                                                                    {
                                                                        nav.MoveToFirstChild();

                                                                        ListItem item = new ListItem();

                                                                        do
                                                                        {
                                                                            if (nav.LocalName == "Text")
                                                                                item.Text = nav.Value;
                                                                            else if (nav.LocalName == "Value")
                                                                                item.Value = nav.Value;
                                                                        }
                                                                        while (nav.MoveToNext());

                                                                        if ((item.Text != String.Empty) && (item.Value != String.Empty))
                                                                            dropDownList.Items.Add(item);

                                                                        nav.MoveToParent();
                                                                    }
                                                                }
                                                            }
                                                            break;

                                                        default:
                                                            throw new Exception("&lt;Type&gt;的值" + nav.Value + "不合法,合法的值为TextBox,IntegerTextBox或DropDownList");
                                                    }
                                                }

                                                nav.MoveToParent();
                                            }
                                            else
                                                throw new Exception("&lt;Control&gt;下必须有子结点");
                                        }
                                        else
                                            throw new Exception("&lt;Name&gt;后的结点只能为&lt;Control&gt;");
                                    }
                                    else
                                        throw new Exception("&lt;Parameter&gt;下不能只有&lt;Name&gt;结点");

                                    row.Cells.AddRange(cell);
                                    table.Rows.Add(row);
                                }
                                else
                                    throw new Exception("&lt;Parameter&gt;下的第一个结点必须为&lt;Name&gt;");

                                nav.MoveToParent();
                            }
                            else
                                throw new Exception("&lt;Parameter&gt;下必须有子结点");
                        }
                        else
                            throw new Exception("结点&lt;" + nav.LocalName + "&gt;不合法");
                    }
                    while (nav.MoveToNext());

                    panel.Controls.Add(table);

                    Button button = new Button();
                    button.Text = templateName;
                    button.CommandName = templateList.Count.ToString();
                    button.Click += new EventHandler(Button_Click);
                    button.OnClientClick = "if (Page_ClientValidate()){return window.confirm('确认执行GM指令吗?');}";
                    panel.Controls.Add(button);

                    templateTableCell.Controls.Add(panel);

                    template.TemplatePanel = panel;
                    template.cmd = cmd;

                    templateList.Add(template);

                    nav.MoveToParent();
                }
                else
                    throw new Exception("&lt;Template&gt;下必须有子结点");                
            }            
        }
        while (nav.MoveToNext());

        if (IsPostBack == false)
            ListBoxOperation.SelectedIndex = 0;

        SetPanelVisible();    
    }
Ejemplo n.º 6
0
 protected virtual void Page_Init(object sender, EventArgs e)
 {
     foreach (object r in Page.Validators)
     {
         if (r is RequiredFieldValidator)
         {
             RequiredFieldValidator req = r as RequiredFieldValidator;
             req.Display = ValidatorDisplay.None;
             req.ErrorMessage = "You must enter a value in this field";
             AjaxControlToolkit.ValidatorCalloutExtender validatorCalloutExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
             validatorCalloutExtender.ID = req.ID + "vce";
             validatorCalloutExtender.WarningIconImageUrl = "~/system/backend/lib/img/warning.gif";
             validatorCalloutExtender.TargetControlID = req.ID;
             validatorCalloutExtender.HighlightCssClass = "highlight";
             req.Parent.Controls.Add(validatorCalloutExtender);
         }
         else if (r is CompareValidator)
         {
             CompareValidator req = r as CompareValidator;
             req.Display = ValidatorDisplay.None;
             req.ErrorMessage = "Passwords do not Match";
             AjaxControlToolkit.ValidatorCalloutExtender validatorCalloutExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
             validatorCalloutExtender.ID = req.ID + "ValidatorCalloutExtender1";
             validatorCalloutExtender.WarningIconImageUrl = "~/system/backend/lib/img/warning.gif";
             validatorCalloutExtender.TargetControlID = req.ID;
             validatorCalloutExtender.HighlightCssClass = "highlight";
             req.Parent.Controls.Add(validatorCalloutExtender);
         }
         else if (r is CustomValidator)
         {
             CustomValidator req = r as CustomValidator;
             req.Display = ValidatorDisplay.None;
             AjaxControlToolkit.ValidatorCalloutExtender validatorCalloutExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
             validatorCalloutExtender.ID = req.ID + "ValidatorCalloutExtender1";
             validatorCalloutExtender.TargetControlID = req.ID;
             validatorCalloutExtender.HighlightCssClass = "highlight";
             validatorCalloutExtender.WarningIconImageUrl = "~/system/backend/lib/img/warning.gif";
             req.Parent.Controls.Add(validatorCalloutExtender);
         }
         else if (r is RangeValidator)
         {
             RangeValidator req = r as RangeValidator;
             req.Display = ValidatorDisplay.None;
             AjaxControlToolkit.ValidatorCalloutExtender validatorCalloutExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
             validatorCalloutExtender.ID = req.ID + "ValidatorCalloutExtender1";
             validatorCalloutExtender.TargetControlID = req.ID;
             validatorCalloutExtender.HighlightCssClass = "highlight";
             req.Parent.Controls.Add(validatorCalloutExtender);
         }
         else if (r is RegularExpressionValidator)
         {
             RegularExpressionValidator req = r as RegularExpressionValidator;
             req.Display = ValidatorDisplay.None;
             AjaxControlToolkit.ValidatorCalloutExtender validatorCalloutExtender = new AjaxControlToolkit.ValidatorCalloutExtender();
             validatorCalloutExtender.ID = req.ID + "ValidatorCalloutExtender1";
             validatorCalloutExtender.TargetControlID = req.ID;
             validatorCalloutExtender.HighlightCssClass = "highlight";
             validatorCalloutExtender.WarningIconImageUrl = "~/system/backend/lib/img/warning.gif";
             req.Parent.Controls.Add(validatorCalloutExtender);
         }
     }
 }
Ejemplo n.º 7
0
    private void CreateConfigParametersTableByXml()
    {
        ArrayList parametersArrayList = new ArrayList();

        XPathNavigator nav;
        XPathDocument  docNav;

        docNav = new XPathDocument(WebConfig.WebsiteRootPath + "AddServerGroupConfigParameters.xml");
        nav    = docNav.CreateNavigator();
        nav.MoveToRoot();
        nav.MoveToFirstChild();
        nav.MoveToFirstChild();

        do
        {
            if (nav.NodeType == XPathNodeType.Element)
            {
                if (nav.HasChildren)
                {
                    nav.MoveToFirstChild();

                    TableRow    row  = new TableRow();
                    TableCell[] cell = new TableCell[3];
                    for (int i = 0; i < 3; i++)
                    {
                        cell[i] = new TableCell();
                    }

                    cell[0].Width       = new Unit(25f, UnitType.Percentage);
                    cell[0].Style.Value = "text-align: center;font-weight: bold;color: #FFFFFF;background-color: #5099B3;height: 20px;border-bottom: solid 1px #808080;border-right: solid 1px #808080;";
                    cell[1].Width       = new Unit(20f, UnitType.Percentage);
                    cell[2].Width       = new Unit(80f, UnitType.Percentage);

                    string textBoxName = String.Empty;

                    TextBox textBox = new TextBox();

                    do
                    {
                        if (nav.LocalName == "Name")
                        {
                            cell[0].Text = nav.Value;
                            textBoxName  = nav.Value.Remove(0, 1);
                            textBoxName  = textBoxName.Remove(textBoxName.Length - 1, 1);
                            parametersArrayList.Add(textBoxName);
                            textBox.ID = textBoxName;
                        }
                        else if (nav.LocalName == "Note")
                        {
                            cell[2].Text = nav.Value;
                        }
                        else if (nav.LocalName == "DefaultValue")
                        {
                            textBox.Text = nav.Value;
                        }
                    }while (nav.MoveToNext());

                    RequiredFieldValidator validator = new RequiredFieldValidator();
                    validator.ControlToValidate = textBox.ID;
                    validator.ID              = validator.ControlToValidate + "Validator";
                    validator.Display         = ValidatorDisplay.None;
                    validator.SetFocusOnError = true;
                    validator.ErrorMessage    = StringDef.RequiredFieldValidatorErrorMsg;
                    AjaxControlToolkit.ValidatorCalloutExtender extender = new AjaxControlToolkit.ValidatorCalloutExtender();
                    extender.TargetControlID = validator.ID;
                    cell[1].Controls.Add(textBox);
                    cell[1].Controls.Add(validator);
                    cell[1].Controls.Add(extender);

                    row.Cells.AddRange(cell);
                    ConfigParametersTable.Rows.Add(row);
                }
            }

            nav.MoveToParent();
        }while (nav.MoveToNext());

        Session["ConfigParameters"] = parametersArrayList;
    }
Ejemplo n.º 8
0
    private void CreateConfigParametersTableByXml()
    {
        ArrayList parametersArrayList = new ArrayList();

        XPathNavigator nav;
        XPathDocument docNav;

        docNav = new XPathDocument(WebConfig.WebsiteRootPath + "AddServerGroupConfigParameters.xml");
        nav = docNav.CreateNavigator();
        nav.MoveToRoot();
        nav.MoveToFirstChild();
        nav.MoveToFirstChild();

        do
        {
            if (nav.NodeType == XPathNodeType.Element)
            {
                if (nav.HasChildren)
                {
                    nav.MoveToFirstChild();

                    TableRow row = new TableRow();
                    TableCell[] cell = new TableCell[3];
                    for (int i = 0; i < 3; i++)
                        cell[i] = new TableCell();

                    cell[0].Width = new Unit(25f, UnitType.Percentage);
                    cell[0].Style.Value = "text-align: center;font-weight: bold;color: #FFFFFF;background-color: #5099B3;height: 20px;border-bottom: solid 1px #808080;border-right: solid 1px #808080;";
                    cell[1].Width = new Unit(20f, UnitType.Percentage);
                    cell[2].Width = new Unit(80f, UnitType.Percentage);

                    string textBoxName = String.Empty;
                    
                    TextBox textBox = new TextBox();

                    do
                    {
                        if (nav.LocalName == "Name")
                        {
                            cell[0].Text = nav.Value;
                            textBoxName = nav.Value.Remove(0, 1);
                            textBoxName = textBoxName.Remove(textBoxName.Length - 1, 1);
                            parametersArrayList.Add(textBoxName);
                            textBox.ID = textBoxName;
                        }
                        else if (nav.LocalName == "Note")
                        {
                            cell[2].Text = nav.Value;
                        }
                        else if (nav.LocalName == "DefaultValue")
                        {
                            textBox.Text = nav.Value;
                        }
                    }
                    while (nav.MoveToNext());
                   
                    RequiredFieldValidator validator = new RequiredFieldValidator();
                    validator.ControlToValidate = textBox.ID;
                    validator.ID = validator.ControlToValidate + "Validator";
                    validator.Display = ValidatorDisplay.None;
                    validator.SetFocusOnError = true;
                    validator.ErrorMessage = StringDef.RequiredFieldValidatorErrorMsg;
                    AjaxControlToolkit.ValidatorCalloutExtender extender = new AjaxControlToolkit.ValidatorCalloutExtender();
                    extender.TargetControlID = validator.ID;
                    cell[1].Controls.Add(textBox);
                    cell[1].Controls.Add(validator);
                    cell[1].Controls.Add(extender);

                    row.Cells.AddRange(cell);
                    ConfigParametersTable.Rows.Add(row);
                }
            }

            nav.MoveToParent();
        }
        while (nav.MoveToNext());

        Session["ConfigParameters"] = parametersArrayList;
    }