Inheritance: ExtenderControlBase
Esempio n. 1
0
        protected override void CreateChildControls()
        {
            Controls.Clear();
            try
            {
                ScriptManager sm = new ScriptManager();
                sm.Services.Add(new ServiceReference("~/Cathexis.LandingPage.Services.StateServices.asmx"));
                Controls.Add(sm);

                //ScriptManager sm = ScriptManager.GetCurrent(this.Page);
                //sm.Services.Add(new ServiceReference("~/Cathexis.PMA.Core.Services.StateServices.asmx"));

                _ddlState = new DropDownList();
                _ddlState.ID = "ddlState";

                _ddlCountry = new DropDownList();
                _ddlCountry.ID = "ddlCountry";


                _lblMessage = new Label();

                _cddCountry = new CascadingDropDown();
                _cddCountry.ID = "CascadingDropDown1";
                _cddCountry.TargetControlID = _ddlCountry.ID;
                _cddCountry.Category = "country";
                _cddCountry.PromptText = "Select One";
                _cddCountry.LoadingText = "Loading...";
                _cddCountry.ServiceMethod = "GetCountries";
                _cddCountry.ServicePath = "~/Cathexis.LandingPage.Services.StateServices.asmx";

                _cddState = new CascadingDropDown();
                _cddState.ID = "CascadingDropDown2";
                _cddState.TargetControlID = _ddlState.ID;
                _cddState.Category = "state";
                _cddState.PromptText = "Select One";
                _cddState.LoadingText = "Loading...";
                _cddState.ServiceMethod = "GetDropDownContent";
                _cddState.ParentControlID = _ddlCountry.ID;
                _cddState.ServicePath = "~/Cathexis.LandingPage.Services.StateServices.asmx";

                Controls.Add(_ddlCountry);
                Controls.Add(_ddlState);
                Controls.Add(_lblMessage);
                Controls.Add(_cddCountry);
                Controls.Add(_cddState);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

        }
Esempio n. 2
0
        public virtual void CreateControlHeirarchy()
        {
            HtmlTable table = new HtmlTable();
            table.Build(2, 7);
            Controls.Add(table);

            ErrorValidationSummary = new ValidationSummary
                {
                    ShowSummary = false,
                    ShowMessageBox = true
                };

            ScriptManager sm = ScriptManager.GetCurrent(this.Page);
            sm.Services.Add(new ServiceReference("~/Cathexis.LandingPage.Services.StateServices.asmx"));

            // first table cell 2 wide
            table.Rows[0].Cells.RemoveAt(1);
            table.Rows[0].Cells[0].ColSpan = 2;

            table.Rows[0].Cells[0].Controls.Add(ErrorValidationSummary);

            FirstNameLabel = new Label { Text = "First Name:" };
            table.Rows[1].Cells[0].Controls.Add(FirstNameLabel);

            FirstNameTextBox = new PopulatedTextBox 
                { 
                    ID = "FirstNameTextbox", 
                    RequestVariableName = "f" 
                };
            table.Rows[1].Cells[1].Controls.Add(FirstNameTextBox);

            FirstNameReqValidator = new RequiredFieldValidator
                {
                    ControlToValidate = FirstNameTextBox.ID,
                    ErrorMessage = "'First Name' is not valid.",
                    Text = "*"
                };
            table.Rows[1].Cells[1].Controls.Add(FirstNameReqValidator);

            LastNameLabel = new Label { Text = "Last Name:" };
            table.Rows[2].Cells[0].Controls.Add(LastNameLabel);

            LastNameTextBox = new PopulatedTextBox 
                { 
                    ID = "LastNameTextBox", 
                    RequestVariableName = "l" 
                };
            table.Rows[2].Cells[1].Controls.Add(LastNameTextBox);

            LastNameReqValidator = new RequiredFieldValidator
                {
                    ControlToValidate = LastNameTextBox.ID,
                    ErrorMessage = "'Last Name' is not valid.",
                    Text = "*"
                };
            table.Rows[2].Cells[1].Controls.Add(LastNameReqValidator);

            StateLabel = new Label { Text = "State:" };
            table.Rows[3].Cells[0].Controls.Add(StateLabel);

            StateDropDownList = new DropDownList { ID = "StateDropDownList" };
            table.Rows[3].Cells[1].Controls.Add(StateDropDownList);

            StateReqValidator = new RequiredFieldValidator
            {
                ControlToValidate = StateDropDownList.ID,
                ErrorMessage = "'State' is not valid.",
                Text = "*"
            };
            table.Rows[3].Cells[1].Controls.Add(StateReqValidator);

            CountryLabel = new Label { Text = "Country:" };
            table.Rows[4].Cells[0].Controls.Add(CountryLabel);

            CountryDropDownList = new DropDownList { ID = "CountryDropDownList" };
            table.Rows[4].Cells[1].Controls.Add(CountryDropDownList);

            CountryReqValidator = new RequiredFieldValidator
            {
                ControlToValidate = CountryDropDownList.ID,
                ErrorMessage = "'Country' is not valid.",
                Text = "*"
            };
            table.Rows[4].Cells[1].Controls.Add(CountryReqValidator);

            CountryCascading = new CascadingDropDown
            {
                ID = "CountryCascading",
                TargetControlID = CountryDropDownList.ID,
                Category = "country",
                PromptText = "Select One",
                LoadingText = "Loading...",
                ServiceMethod = "GetCountries",
                ServicePath = "~/Cathexis.LandingPage.Services.StateServices.asmx"
            };

            StateCascading = new CascadingDropDown
            {
                ID = "StateCascading",
                TargetControlID = StateDropDownList.ID,
                Category = "state",
                PromptText = "Select One",
                LoadingText = "Loading...",
                ServiceMethod = "GetDropDownContent",
                ParentControlID = CountryDropDownList.ID,
                ServicePath = "~/Cathexis.LandingPage.Services.StateServices.asmx"
            };

            table.Rows[4].Cells[1].Controls.Add(CountryCascading);
            table.Rows[3].Cells[1].Controls.Add(StateCascading);

            EmailLabel = new Label { Text = "Email:" };
            table.Rows[5].Cells[0].Controls.Add(EmailLabel);

            EmailTextBox = new PopulatedTextBox 
            { 
                ID = "EmailTextBox",
                RequestVariableName = "e"
            };
            table.Rows[5].Cells[1].Controls.Add(EmailTextBox);

            EmailReqValidator = new RequiredFieldValidator
            {
                ControlToValidate = EmailTextBox.ID,
                ErrorMessage = "'Email' is not valid.",
                Text = "*"
            };
            table.Rows[5].Cells[1].Controls.Add(EmailReqValidator);

            PhoneNumberLabel = new Label { Text = "Phone Number" };
            table.Rows[6].Cells[0].Controls.Add(PhoneNumberLabel);

            PhoneNumber = new PhoneNumber();
            table.Rows[6].Cells[1].Controls.Add(PhoneNumber);

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ContractTemplateCascadingDropDown.ServicePath = "~/HRMWebServices.asmx";
            ContractTemplateCascadingDropDown.Category = "ContractTemplate";
            ContractTemplateCascadingDropDown.ServiceMethod = "GetContractTemplatesFromCurrentJobDetails";

            if (RadioButtonList1.SelectedItem.Value != "1")
            {
                System.Web.UI.HtmlControls.HtmlGenericControl li = new System.Web.UI.HtmlControls.HtmlGenericControl("li");
                System.Web.UI.HtmlControls.HtmlGenericControl span = new System.Web.UI.HtmlControls.HtmlGenericControl("label");
                span.InnerText = "Amandament template:";
                span.ID = "AmandamentTemplateLabel";
                span.Attributes.Add("for", "AmandamentTemplateDropDownList");
                li.Controls.Add(span);
                DropDownList ddl = new DropDownList();
                ddl.ID = "AmandamentTemplateDropDownList";
                li.Controls.Add(ddl);
                RequiredFieldValidator rfv = new RequiredFieldValidator();
                rfv.ID = "AmandamentTemplateRequiredFieldValidator";
                rfv.ControlToValidate = "AmandamentTemplateDropDownList";
                rfv.Display = ValidatorDisplay.None;
                rfv.ErrorMessage = "Please select an amandament template.";
                rfv.InitialValue = "";
                li.Controls.Add(rfv);
                CascadingDropDown cdd = new CascadingDropDown();
                cdd.ID = "AmandamentTemplateCascadingDropDown";
                cdd.ServicePath = "~/HRMWebServices.asmx";
                cdd.Category = "AmandamentTemplate";
                cdd.ServiceMethod = "GetAmandamentTemplates";
                cdd.TargetControlID = "AmandamentTemplateDropDownList";
                cdd.ContextKey = "";
                cdd.PromptText = "Please select";
                li.Controls.Add(cdd);

                doubleTemplate.Controls.Add(li);
            }
        }