protected override void Render(HtmlTextWriter writer) { #if !V2 bool DesignMode = this.Context == null; #endif if (!DesignMode) { Anthem.Manager.WriteBeginControlMarker(writer, "span", this); } if (Visible) { if (!DesignMode && _showTextbox) { // Non-IE browsers get a textbox for editing. ASP.TextBox textbox = new ASP.TextBox(); textbox.ID = this.ClientID; textbox.Text = Text; textbox.ApplyStyle(GetStyle()); #if V2 textbox.EnableTheming = this.EnableTheming; #endif textbox.Attributes["onblur"] = string.Format("editLabelSave(this,{0},'{1}','{2}','{3}',{4},{5},{6},{7});", "false", string.Empty, string.Empty, this.TextDuringCallBack, this.EnabledDuringCallBack ? "true" : "false", this.PreCallBackFunction == null || this.PreCallBackFunction.Length == 0 ? "null" : this.PreCallBackFunction, this.PostCallBackFunction == null || this.PostCallBackFunction.Length == 0 ? "null" : this.PostCallBackFunction, this.CallBackCancelledFunction == null || this.CallBackCancelledFunction.Length == 0 ? "null" : this.CallBackCancelledFunction ); textbox.Attributes["onkeypress"] = "return editLabelCheckKey(event);"; textbox.RenderControl(writer); } else { base.Render(writer); } } if (!DesignMode) { Anthem.Manager.WriteEndControlMarker(writer, "span", this); } }
protected void CreateControlHierarchy() { //code = new StringBuilder(); // code.AppendLine("<script>"); // code.AppendLine("function EnableServiceName() {"); // code.AppendLine("var msg= 'Are you sure you want to modify the Web Service Name?" + modifyMessage +"';"); // code.AppendLine("if (confirm(msg)) document.getElementById('selfReg_btnModifyService').disabled = false;"); // code.AppendLine("else{ document.getElementById('txtServiceName').value = document.getElementById('bakServiceName').value;}}</script>"); // code.AppendLine(); // code.AppendLine("<script>function EnableCodeBase() {"); // code.AppendLine("var msg= 'Are you sure you want to modify the CodeBase for this service?" + modifyMessage + "';"); // code.AppendLine("if (confirm(msg))document.getElementById('btnModifyService').disabled = false;"); // code.AppendLine("else{document.getElementById('txtCodebaseUrl').value = document.getElementById('bakCodebase').value;}}"); // code.AppendLine(); // code.AppendLine("function EnableServiceUrl() {"); // code.AppendLine("var msg= 'Are you sure you want to modify the Web Service URL?" + modifyMessage + "';"); // code.AppendLine("if (confirm(msg))document.getElementById('btnModifyService').disabled = false;"); // code.AppendLine("else{document.getElementById('txtWebServiceUrl').value = document.getElementById('bakServiceUrl').value;}}"); // code.AppendLine(); // code.AppendLine("function ConfirmRetire() {"); // code.AppendLine("var msg= 'Are you sure you want to retire this WebService.\\nIf you proceed all references to this site will be retired';"); // code.AppendLine("var state = confirm(msg);return state;}"); // code.AppendLine("</script>"); // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OnNameChange", code.ToString()); pageintro = new HtmlGenericControl("div"); pageintro.ID ="pageintro"; lblTitle = new Label(); lblTitle.Text = "Self Registration for " + AgentType; lblTitle.ID = "lblTitle"; lblTitle.Visible = true; lblResponse = new Label(); lblResponse.ID = "lblResponse"; lblResponse.Text = Response; lblResponse.Visible = ResponseVisible; lblIntroduction = new Label(); lblIntroduction.ID = "lblIntroduction"; lblIntroduction.Text = Intro; lblIntroduction.Visible = true; lblServiceType = new Label(); lblServiceType.ID = "lblServiceType"; lblServiceType.Text = AgentType; HtmlGenericControl h1 = new HtmlGenericControl("h2"); h1.Controls.Add(lblTitle); pageintro.Controls.Add(h1); HtmlGenericControl p = new HtmlGenericControl("p"); p.Controls.Add(lblIntroduction); pageintro.Controls.Add(p); if (ResponseVisible) { p = new HtmlGenericControl("p"); p.Controls.Add(lblResponse); pageintro.Controls.Add(p); } Controls.Add(pageintro); pagecontent = new HtmlGenericControl("div"); pagecontent.ID = "pagecontent"; //frmRegister = new HtmlForm(); //frmRegister.Method = "post"; //frmRegister.Target = ""; //frmRegister.Name = "RegisterSelf"; //frmRegister.ID = "frmRegister"; tblMain = new Table(); tblMain.CssClass = "simpleform"; tblMain.Width = width; Literal spacer = new Literal(); spacer.Text = " "; Style s1 = new Style(); s1.Width = labelWidth; s1.Height = onePX; s1.ForeColor = ForeColor; Style s2 = new Style(); s2.Width = guidWidth; s2.ForeColor = BorderColor; Style s3 = new Style(); s3.Width = buttonColumnWidth; s3.ForeColor = ForeColor; Style s4 = new Style(); s4.Width = dataWidth; Style txtAreaStyle = new Style(); //txtAreaStyle.Height = txtBoxHeight; txtAreaStyle.Width = dataWidth; txtAreaStyle.BorderColor = BorderColor; Style txtBoxStyle = new Style(); txtBoxStyle.Height = txtBoxHeight; txtBoxStyle.Width = dataWidth; txtBoxStyle.BorderColor = BorderColor; Style txtGuidStyle = new Style(); txtGuidStyle.Height = txtBoxHeight; txtGuidStyle.Width = guidWidth; txtGuidStyle.BorderColor = BorderColor; TableRow row; TableHeaderCell th; TableCell td; TableCell td2; //Label lbl; //Create the first row row = new TableRow(); th = new TableHeaderCell(); th.ApplyStyle(s1); td = new TableCell(); td.ApplyStyle(s2); td2 = new TableCell(); td2.ApplyStyle(s3); row.Cells.Add(th); row.Cells.Add(td); row.Cells.Add(td2); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); th.ColumnSpan = 3; th.Style.Add(HtmlTextWriterStyle.TextAlign, "center"); th.Text = "Required Credential Information"; row.Cells.Add(th); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblServiceName = new Label(); lblServiceName.ID = "lblServiceName"; lblServiceName.Text = "Service Name"; th.Controls.Add(lblServiceName); td = new TableCell(); td.ColumnSpan = 2; txtServiceName = new TextBox(); txtServiceName.ID = "txtServiceName"; txtServiceName.ApplyStyle(txtBoxStyle); txtServiceName.Text = AgentName; td.Controls.Add(txtServiceName); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblServiceGuid = new Label(); lblServiceGuid.ID = "lblServiceGuid"; lblServiceGuid.Text = "Service GUID"; th.Controls.Add(lblServiceGuid); td = new TableCell(); td.ColumnSpan = 1; txtServiceGuid = new TextBox(); txtServiceGuid.ID = "txtServiceGuid"; txtServiceGuid.ApplyStyle(txtGuidStyle); txtServiceGuid.Text = AgentGuid; td.Controls.Add(txtServiceGuid); td2 = new TableCell(); td2.ApplyStyle(s3); btnGuid = new Button(); btnGuid.Text = "Create GUID"; btnGuid.ID = "btnGuid"; btnGuid.Click += btnGuid_Click; btnGuid.Enabled = false; td2.Controls.Add(btnGuid); row.Cells.Add(th); row.Cells.Add(td); row.Cells.Add(td2); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblCodebaseUrl = new Label(); lblCodebaseUrl.ID = "lblCodebaseUrl"; lblCodebaseUrl.Text = "Codebase URL"; th.Controls.Add(lblCodebaseUrl); td = new TableCell(); td.ColumnSpan = 2; txtCodebaseUrl = new TextBox(); txtCodebaseUrl.ID = "txtCodebaseUrl"; txtCodebaseUrl.ApplyStyle(txtBoxStyle); txtCodebaseUrl.Text = CodebaseUrl; td.Controls.Add(txtCodebaseUrl); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblServiceUrl = new Label(); lblServiceUrl.ID = "lblServiceUrl"; lblServiceUrl.Text = "Web Service URL"; th.Controls.Add(lblServiceUrl); td = new TableCell(); td.ColumnSpan = 2; txtServiceUrl = new TextBox(); txtServiceUrl.ID = "txtServiceUrl"; txtServiceUrl.ApplyStyle(txtBoxStyle); txtServiceUrl.Text = WebServiceUrl; td.Controls.Add(txtServiceUrl); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); trDomainSB = new TableRow(); trDomainSB.ID = "trDomainSB"; th = new TableHeaderCell(); lblDomainServer = new Label(); lblDomainServer.ID = "lblDomainServer"; lblDomainServer.Text = "Domain ServiceBroker"; th.Controls.Add(lblDomainServer); td = new TableCell(); td.ColumnSpan = 2; txtDomainServer = new TextBox(); txtDomainServer.ApplyStyle(txtBoxStyle); txtDomainServer.Text = DomainServer; td.Controls.Add(txtDomainServer); trDomainSB.Cells.Add(th); trDomainSB.Cells.Add(td); tblMain.Rows.Add(trDomainSB); trDomainSB.Visible = (AgentType == ProcessAgentType.SERVICE_BROKER || AgentType == ProcessAgentType.BATCH_SERVICE_BROKER) ? false :true; trRowPasskey = new TableRow(); th = new TableHeaderCell(); lblOutPassKey = new Label(); lblOutPassKey.ID = "lblOutPassKey"; lblOutPassKey.Text = "Install Credential Passkey"; th.Controls.Add(lblOutPassKey); td = new TableCell(); td.ColumnSpan = 2; txtOutPasskey = new TextBox(); txtOutPasskey.ApplyStyle(txtBoxStyle); txtOutPasskey.Text = ConfigurationManager.AppSettings["defaultPasskey"]; td.Controls.Add(txtOutPasskey); td2 = new TableCell(); td2.ApplyStyle(s3); trRowPasskey.Cells.Add(th); trRowPasskey.Cells.Add(td); tblMain.Rows.Add(trRowPasskey); row = new TableRow(); th = new TableHeaderCell(); th.ColumnSpan = 3; th.Style.Add(HtmlTextWriterStyle.TextAlign, "center"); th.Text = "Optional Information"; row.Cells.Add(th); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblDescription = new Label(); lblDescription.ID = "lblDescription"; lblDescription.Text = "Description"; th.Controls.Add(lblDescription); td = new TableCell(); td.ColumnSpan = 2; txtDescription = new TextBox(); txtDescription.TextMode = TextBoxMode.MultiLine; txtDescription.Columns = 50; txtDescription.Rows = 4; txtDescription.Wrap = true; txtDescription.ApplyStyle(txtAreaStyle); txtDescription.Text = Description; td.Controls.Add(txtDescription); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblInfoUrl = new Label(); lblInfoUrl.ID = "lblInfoUrl"; lblInfoUrl.Text = "Information URL"; th.Controls.Add(lblInfoUrl); td = new TableCell(); td.ColumnSpan = 2; txtInfoUrl = new TextBox(); txtInfoUrl.ApplyStyle(txtBoxStyle); txtInfoUrl.Text = InfoUrl; td.Controls.Add(txtInfoUrl); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblContactInfo = new Label(); lblContactInfo.ID = "lblContactInfo"; lblContactInfo.Text = "Contact Email"; th.Controls.Add(lblContactInfo); td = new TableCell(); td.ColumnSpan = 2; txtContactInfo = new TextBox(); txtContactInfo.ApplyStyle(txtBoxStyle); txtContactInfo.Text = ContactEmail; td.Controls.Add(txtContactInfo); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblBugEmail = new Label(); lblBugEmail.ID = "lblBugEmail"; lblBugEmail.Text = "Bug Email"; th.Controls.Add(lblBugEmail); td = new TableCell(); td.ColumnSpan = 2; txtBugEmail = new TextBox(); txtBugEmail.ApplyStyle(txtBoxStyle); txtBugEmail.Text = BugEmail; td.Controls.Add(txtBugEmail); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); lblLocation = new Label(); lblLocation.ID = "lblLocation"; lblLocation.Text = "Location"; th.Controls.Add(lblLocation); td = new TableCell(); td.ColumnSpan = 2; txtLocation = new TextBox(); txtLocation.ApplyStyle(txtBoxStyle); txtLocation.Text = Location; td.Controls.Add(txtLocation); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); row = new TableRow(); th = new TableHeaderCell(); th.ColumnSpan = 2; btnSave = new Button(); btnSave.ID = "btnSave"; btnSave.Text = "Save Service"; btnSave.CommandName = "Save"; btnSave.Click += btnSave_Click; btnSave.Enabled = false; th.Controls.Add(btnSave); btnModify = new Button(); btnModify.ID = "btnModify"; btnModify.Text = "Modify Service"; btnModify.CommandName = "Modify"; btnModify.Click += btnModify_Click; btnModify.OnClientClick = "javascript:return confirm('Are you sure you want to modify this WebService?\\n If you proceed all references to this site will be modified.');"; btnModify.Enabled = false; th.Controls.Add(btnModify); th.Controls.Add(spacer); btnRefresh = new Button(); btnRefresh.Text = "Refresh"; btnRefresh.CommandName="Refresh"; btnRefresh.ID= "btnRefresh"; btnRefresh.Click += btnRefresh_Click; th.Controls.Add(btnRefresh); th.Controls.Add(spacer); btnClear = new Button(); btnClear.Text = "Clear"; btnClear.CommandName="Clear"; btnClear.ID="btnClear"; btnClear.Click += btnClear_Click; btnClear.OnClientClick = "javascript:return confirm('Are you sure you want to clear the page?\\n Are you really sure');"; th.Controls.Add(btnClear); th.Controls.Add(spacer); btnRetire = new Button(); btnRetire.ID = "btnRetire"; btnRetire.Text = "Retire"; btnRetire.CommandName="Retire"; btnRetire.Click += btnRetire_Click; btnRetire.OnClientClick="javascript:return confirm('Are you sure you want to retire this WebService?\\nIf you proceed all references to this site will be retired');"; th.Controls.Add(btnRetire); td = new TableCell(); row.Cells.Add(th); row.Cells.Add(td); tblMain.Rows.Add(row); pagecontent.Controls.Add(tblMain); hdnServiceGuid = new HiddenField(); hdnServiceGuid.ID = "bakServiceGuid"; pagecontent.Controls.Add(hdnServiceGuid); hdnServiceName = new HiddenField(); hdnServiceName.ID = "bakServiceName"; pagecontent.Controls.Add(hdnServiceName); hdnServiceUrl = new HiddenField(); hdnServiceUrl.ID = "bakServiceUrl"; pagecontent.Controls.Add(hdnServiceUrl); hdnCodebaseUrl = new HiddenField(); hdnCodebaseUrl.ID = "bakCodebaseUrl"; pagecontent.Controls.Add(hdnCodebaseUrl); //pagecontent.Controls.Add(frmRegister); Controls.Add(pagecontent); ChildControlsCreated = true; SetFormMode(HasDomain); }
public void InstantiateIn (Control container) { Table table = new Table (); table.CellPadding = 0; // Row #0 table.Controls.Add ( CreateRow (new LiteralControl (_owner.ChangePasswordTitleText), null, null, _owner.TitleTextStyle, null)); // Row #1 if (_owner.InstructionText.Length > 0) { table.Controls.Add ( CreateRow (new LiteralControl (_owner.InstructionText), null, null, _owner.InstructionTextStyle, null)); } // Row #2 if (_owner.DisplayUserName) { TextBox UserName = new TextBox (); UserName.ID = "UserName"; UserName.Text = _owner.UserName; UserName.ApplyStyle (_owner.TextBoxStyle); Label UserNameLabel = new Label (); UserNameLabel.ID = "UserNameLabel"; UserNameLabel.AssociatedControlID = "UserName"; UserNameLabel.Text = _owner.UserNameLabelText; RequiredFieldValidator UserNameRequired = new RequiredFieldValidator (); UserNameRequired.ID = "UserNameRequired"; UserNameRequired.ControlToValidate = "UserName"; UserNameRequired.ErrorMessage = _owner.UserNameRequiredErrorMessage; UserNameRequired.ToolTip = _owner.UserNameRequiredErrorMessage; UserNameRequired.Text = "*"; UserNameRequired.ValidationGroup = _owner.ID; UserNameRequired.ApplyStyle (_owner.ValidatorTextStyle); table.Controls.Add (CreateRow (UserNameLabel, UserName, UserNameRequired, _owner.LabelStyle, null)); } // Row #3 TextBox CurrentPassword = new TextBox (); CurrentPassword.ID = "CurrentPassword"; CurrentPassword.TextMode = TextBoxMode.Password; CurrentPassword.ApplyStyle (_owner.TextBoxStyle); Label CurrentPasswordLabel = new Label (); CurrentPasswordLabel.ID = "CurrentPasswordLabel"; CurrentPasswordLabel.AssociatedControlID = "CurrentPasswordLabel"; CurrentPasswordLabel.Text = _owner.PasswordLabelText; RequiredFieldValidator CurrentPasswordRequired = new RequiredFieldValidator (); CurrentPasswordRequired.ID = "CurrentPasswordRequired"; CurrentPasswordRequired.ControlToValidate = "CurrentPassword"; CurrentPasswordRequired.ErrorMessage = _owner.PasswordRequiredErrorMessage; CurrentPasswordRequired.ToolTip = _owner.PasswordRequiredErrorMessage; CurrentPasswordRequired.Text = "*"; CurrentPasswordRequired.ValidationGroup = _owner.ID; CurrentPasswordRequired.ApplyStyle (_owner.ValidatorTextStyle); table.Controls.Add (CreateRow (CurrentPasswordLabel, CurrentPassword, CurrentPasswordRequired, _owner.LabelStyle, null)); // Row #4 TextBox NewPassword = new TextBox (); NewPassword.ID = "NewPassword"; NewPassword.TextMode = TextBoxMode.Password; NewPassword.ApplyStyle (_owner.TextBoxStyle); Label NewPasswordLabel = new Label (); NewPasswordLabel.ID = "NewPasswordLabel"; NewPasswordLabel.AssociatedControlID = "NewPassword"; NewPasswordLabel.Text = _owner.NewPasswordLabelText; RequiredFieldValidator NewPasswordRequired = new RequiredFieldValidator (); NewPasswordRequired.ID = "NewPasswordRequired"; NewPasswordRequired.ControlToValidate = "NewPassword"; NewPasswordRequired.ErrorMessage = _owner.PasswordRequiredErrorMessage; NewPasswordRequired.ToolTip = _owner.PasswordRequiredErrorMessage; NewPasswordRequired.Text = "*"; NewPasswordRequired.ValidationGroup = _owner.ID; NewPasswordRequired.ApplyStyle (_owner.ValidatorTextStyle); table.Controls.Add (CreateRow (NewPasswordLabel, NewPassword, NewPasswordRequired, _owner.LabelStyle, null)); // Row #5 if (_owner.PasswordHintText.Length > 0) { table.Controls.Add ( CreateRow (new LiteralControl (""), new LiteralControl (_owner.PasswordHintText), new LiteralControl (""), null, _owner.PasswordHintStyle)); } // Row #6 TextBox ConfirmNewPassword = new TextBox (); ConfirmNewPassword.ID = "ConfirmNewPassword"; ConfirmNewPassword.TextMode = TextBoxMode.Password; ConfirmNewPassword.ApplyStyle (_owner.TextBoxStyle); Label ConfirmNewPasswordLabel = new Label (); ConfirmNewPasswordLabel.ID = "ConfirmNewPasswordLabel"; ConfirmNewPasswordLabel.AssociatedControlID = "ConfirmNewPasswordLabel"; ConfirmNewPasswordLabel.Text = _owner.ConfirmNewPasswordLabelText; RequiredFieldValidator ConfirmNewPasswordRequired = new RequiredFieldValidator (); ConfirmNewPasswordRequired.ID = "ConfirmNewPasswordRequired"; ConfirmNewPasswordRequired.ControlToValidate = "ConfirmNewPassword"; ConfirmNewPasswordRequired.ErrorMessage = _owner.PasswordRequiredErrorMessage; ConfirmNewPasswordRequired.ToolTip = _owner.PasswordRequiredErrorMessage; ConfirmNewPasswordRequired.Text = "*"; ConfirmNewPasswordRequired.ValidationGroup = _owner.ID; ConfirmNewPasswordRequired.ApplyStyle (_owner.ValidatorTextStyle); table.Controls.Add (CreateRow (ConfirmNewPasswordLabel, ConfirmNewPassword, ConfirmNewPasswordRequired, _owner.LabelStyle, null)); // Row #7 CompareValidator NewPasswordCompare = new CompareValidator (); NewPasswordCompare.ID = "NewPasswordCompare"; NewPasswordCompare.ControlToCompare = "NewPassword"; NewPasswordCompare.ControlToValidate = "ConfirmNewPassword"; NewPasswordCompare.Display = ValidatorDisplay.Dynamic; NewPasswordCompare.ErrorMessage = _owner.ConfirmPasswordCompareErrorMessage; NewPasswordCompare.ValidationGroup = _owner.ID; table.Controls.Add (CreateRow (NewPasswordCompare, null, null, null, null)); // Row #8 Literal FailureTextLiteral = new Literal (); FailureTextLiteral.ID = "FailureText"; FailureTextLiteral.EnableViewState = false; if (_owner.FailureTextStyle.ForeColor.IsEmpty) _owner.FailureTextStyle.ForeColor = System.Drawing.Color.Red; table.Controls.Add (CreateRow (FailureTextLiteral, null, null, _owner.FailureTextStyle, null)); // Row #9 WebControl ChangePasswordButton = null; switch (_owner.ChangePasswordButtonType) { case ButtonType.Button: ChangePasswordButton = new Button (); break; case ButtonType.Image: ChangePasswordButton = new ImageButton (); break; case ButtonType.Link: ChangePasswordButton = new LinkButton (); break; } ChangePasswordButton.ID = "ChangePasswordPushButton"; ChangePasswordButton.ApplyStyle (_owner.ChangePasswordButtonStyle); ((IButtonControl) ChangePasswordButton).CommandName = ChangePassword.ChangePasswordButtonCommandName; ((IButtonControl) ChangePasswordButton).Text = _owner.ChangePasswordButtonText; ((IButtonControl) ChangePasswordButton).ValidationGroup = _owner.ID; WebControl CancelButton = null; switch (_owner.CancelButtonType) { case ButtonType.Button: CancelButton = new Button (); break; case ButtonType.Image: CancelButton = new ImageButton (); break; case ButtonType.Link: CancelButton = new LinkButton (); break; } CancelButton.ID = "CancelPushButton"; CancelButton.ApplyStyle (_owner.CancelButtonStyle); ((IButtonControl) CancelButton).CommandName = ChangePassword.CancelButtonCommandName; ((IButtonControl) CancelButton).Text = _owner.CancelButtonText; ((IButtonControl) CancelButton).CausesValidation = false; table.Controls.Add (CreateRow (ChangePasswordButton, CancelButton, new LiteralControl (""), null, null)); // Row #10 TableRow linksRow = new TableRow (); TableCell linksCell = new TableCell (); linksCell.ColumnSpan = 2; linksCell.ControlStyle.CopyFrom (_owner.HyperLinkStyle); linksRow.Cells.Add (linksCell); if (AddLink (_owner.HelpPageUrl, _owner.HelpPageText, _owner.HelpPageIconUrl, linksCell)) linksCell.Controls.Add (new LiteralControl ("<br/>")); if (AddLink (_owner.CreateUserUrl, _owner.CreateUserText, _owner.CreateUserIconUrl, linksCell)) linksCell.Controls.Add (new LiteralControl ("<br/>")); if (AddLink (_owner.PasswordRecoveryUrl, _owner.PasswordRecoveryText, _owner.PasswordRecoveryIconUrl, linksCell)) linksCell.Controls.Add (new LiteralControl ("<br/>")); AddLink (_owner.EditProfileUrl, _owner.EditProfileText, _owner.EditProfileIconUrl, linksCell); table.Controls.Add (linksRow); container.Controls.Add (table); }
public void InstantiateIn (Control container) { Table table = new Table (); table.CellPadding = 0; bool twoCells = _owner.TextLayout == LoginTextLayout.TextOnLeft; // row 0 table.Rows.Add ( TemplateUtils.CreateRow (new LiteralControl (_owner.QuestionTitleText), null, _owner.TitleTextStyle, null, twoCells)); // row 1 table.Rows.Add ( TemplateUtils.CreateRow (new LiteralControl (_owner.QuestionInstructionText), null, _owner.InstructionTextStyle, null, twoCells)); // row 2 Literal UserNameLiteral = new Literal (); UserNameLiteral.ID = "UserName"; table.Rows.Add ( TemplateUtils.CreateRow (new LiteralControl (_owner.UserNameLabelText), UserNameLiteral, _owner.LabelStyle, _owner.LabelStyle, twoCells)); // row 3 Literal QuestionLiteral = new Literal (); QuestionLiteral.ID = "Question"; table.Rows.Add ( TemplateUtils.CreateRow (new LiteralControl (_owner.QuestionLabelText), QuestionLiteral, _owner.LabelStyle, _owner.LabelStyle, twoCells)); // row 5 TextBox AnswerTextBox = new TextBox (); AnswerTextBox.ID = "Answer"; AnswerTextBox.ApplyStyle (_owner.TextBoxStyle); Label AnswerLabel = new Label (); AnswerLabel.ID = "AnswerLabel"; AnswerLabel.AssociatedControlID = "Answer"; AnswerLabel.Text = _owner.AnswerLabelText; AnswerLabel.ApplyStyle (_owner.LabelStyle); RequiredFieldValidator AnswerRequired = new RequiredFieldValidator (); AnswerRequired.ID = "AnswerRequired"; AnswerRequired.ControlToValidate = "Answer"; AnswerRequired.ErrorMessage = _owner.AnswerRequiredErrorMessage; AnswerRequired.ToolTip = _owner.AnswerRequiredErrorMessage; AnswerRequired.Text = "*"; AnswerRequired.ValidationGroup = _owner.ID; AnswerRequired.ApplyStyle (_owner.ValidatorTextStyle); if (twoCells) { TableRow row = TemplateUtils.CreateRow (AnswerLabel, AnswerTextBox, null, null, twoCells); row.Cells [1].Controls.Add (AnswerRequired); table.Rows.Add (row); } else { table.Rows.Add (TemplateUtils.CreateRow (AnswerLabel, null, null, null, twoCells)); TableRow row = TemplateUtils.CreateRow (AnswerTextBox, null, null, null, twoCells); row.Cells [0].Controls.Add (AnswerRequired); table.Rows.Add (row); } // row 6 Literal FailureText = new Literal (); FailureText.ID = "FailureText"; if (_owner.FailureTextStyle.ForeColor.IsEmpty) _owner.FailureTextStyle.ForeColor = System.Drawing.Color.Red; table.Rows.Add (TemplateUtils.CreateRow (FailureText, null, _owner.FailureTextStyle, null, twoCells)); // row 7 WebControl SubmitButton = null; switch (_owner.SubmitButtonType) { case ButtonType.Button: SubmitButton = new Button (); break; case ButtonType.Image: SubmitButton = new ImageButton (); break; case ButtonType.Link: SubmitButton = new LinkButton (); break; } SubmitButton.ID = "SubmitButton"; SubmitButton.ApplyStyle (_owner.SubmitButtonStyle); ((IButtonControl) SubmitButton).CommandName = PasswordRecovery.SubmitButtonCommandName; ((IButtonControl) SubmitButton).Text = _owner.SubmitButtonText; ((IButtonControl) SubmitButton).ValidationGroup = _owner.ID; TableRow buttonRow = TemplateUtils.CreateRow (SubmitButton, null, null, null, twoCells); buttonRow.Cells [0].HorizontalAlign = HorizontalAlign.Right; table.Rows.Add (buttonRow); // row 8 table.Rows.Add ( TemplateUtils.CreateHelpRow ( _owner.HelpPageUrl, _owner.HelpPageText, _owner.HelpPageIconUrl, _owner.HyperLinkStyle, twoCells)); container.Controls.Add (table); }