// ---------------------- CreateTable2ChildControls ------------------------- // create the controls in the "create a new account" table. private void CreateTable2ChildControls(AcHtmlTable InTable) { InTable.AddNewRow( ) .AddNewCell( ) .SetAlign("center") .SetID("NewAccountTitle"); InTable.AddNewRow( ) .AddNewCell( ) .SetAlign("center") .AddNewLinkButton( ) .SetText("Create a new account") .SetID("Link2") .AddClickHandler(new System.EventHandler(this.Link2_Click)); }
// --------------------------- CreateChildControls ------------------------- // called after OnInit, but before LoadPostData. // After this method returns, asp.net will apply the posted values of the controls // from viewstate. ( so only if not postback do control value have to be set ) protected override void CreateChildControls( ) { // main table to hold two sub area tables. ( want the sub area tables to align // one under the other. ) AcHtmlTable alignTable = AddNewTableControl( ); AcHtmlTableCell slot1 = alignTable.AddNewRow( ) .AddNewCell( ); AcHtmlTable subTable1 = slot1.AddNewTable( ) .SetWidth("100%") .SetClass(LoginCssClass); AcHtmlTableCell slot2 = alignTable.AddNewRow( ) .AddNewCell( ); AcHtmlTable subTable2 = slot2.AddNewTable( ) .SetWidth("100%") .SetClass(NewAccountCssClass); // create the HtmlTable control which will hold all the login controls. if (LoginCssClass == "") { subTable1.AddStyle("border", "1px black solid"); } CreateTable1ChildControls(subTable1); // prompt to create a new account in the second table ( below the first ). if (NewAccountCssClass == "") { subTable2.AddStyle("border", "1px black solid"); } CreateTable2ChildControls(subTable2); // apply the prompt error message text to the error message controls. ApplyPromptErrorMessage( ); ApplyPromptTitle( ); ApplyNewAccountText( ); }
// ---------------------- CreateTable1ChildControls ------------------------- // called after OnInit, but before LoadPostData. // After this method returns, asp.net will apply the posted values of the controls // from viewstate. ( so only if not postback do control value have to be set ) private void CreateTable1ChildControls(AcHtmlTable InTable) { AcHtmlTableRow row; AcHtmlTableCell cell; AcHtmlSubmitButton button; // prompt title InTable.AddNewRow( ) .SetID("PromptTitleRow") .AddNewCell( ) .SetID("PromptTitleCell") .SetColSpan(2) .SetInnerHtml(PromptTitle) .SetClass(LoginCssClass) .AddStyle("text-align", "center"); // account number prompt row = InTable.AddNewRow( ) .SetClass(LoginCssClass); row.AddNewCell( ) .SetInnerText("Account number:") .SetClass(LoginCssClass) .AddStyle("text-align", "right"); row.AddNewCell( ).AddNewInputText( ) .SetSize(20) .SetClass(LoginCssClass) .SetID("Text1"); // email address prompt row = InTable.AddNewRow( ) .SetClass(LoginCssClass); row.AddNewCell( ) .SetInnerText("or Email address:") .SetClass(LoginCssClass) .AddStyle("text-align", "right"); row.AddNewCell( ).AddNewInputText( ) .SetSize(20) .SetClass(LoginCssClass) .SetID("Text2"); // password prompt row = InTable.AddNewRow( ) .SetClass(LoginCssClass); row.AddNewCell( ) .SetInnerText("Password:"******"text-align", "right"); row.AddNewCell( ) .SetClass(LoginCssClass) .AddNewInputText("password") .SetClass(LoginCssClass) .SetSize(20) .SetID("Text3"); // Error message row. Later on will set as visible or not depending on if there // is a message to display. row = InTable.AddNewRow( ) .SetClass(LoginCssClass) .SetID("ErrorRow1"); row.AddNewBlankCell( ) .SetClass(LoginCssClass); row.AddNewCell( ) .SetID("ErrorText1") .SetClass(LoginCssClass) .AddStyle("color", "red"); // Remember password check box. row = InTable.AddNewRow( ) .SetClass(LoginCssClass); row.AddNewCell( ) .AddStyle("text-align", "right") .AddNewInputCheckBox( ) .SetID("CheckBox1"); row.AddNewCell( ) .SetInnerText("Remember me on this computer."); // "login" submit button row = InTable.AddNewRow( ) .SetClass(LoginCssClass); row.AddNewCell( ) .SetClass(LoginCssClass); button = row.AddNewCell( ) .AddNewSubmitButton( ) .SetValue("Login") .SetID("Button1"); button.ServerClick += new System.EventHandler(this.Button1_Click); // "forgot your password" asp:LinkButton in a row of its own below the // login button. cell = InTable.AddNewRow( ) .AddNewCell( ) .SetColSpan(2) .SetAlign("center"); LinkButton link = new LinkButton( ); cell.Controls.Add(link); link.Text = "Forgot your password?"; link.ID = "Link1"; link.Click += new System.EventHandler(this.Link1_Click); }
// --------------------------- CreateChildControls ------------------------- // called after OnInit, but before LoadPostData. // After this method returns, asp.net will apply the posted values of the controls // from viewstate. ( so only if not postback do control value have to be set ) protected override void CreateChildControls( ) { AcHtmlTableRow row; AcHtmlSubmitButton button; // create the HtmlTable control which will hold all the login controls. AcHtmlTable main = new AcHtmlTable( ); Controls.Add(main); main.AddStyle("border", "1px black solid"); // title main.AddNewRow( ).AddNewCell( ) .SetColSpan(2) .SetInnerText("New Account") .AddStyle("text-align", "center"); // account name prompt row = main.AddNewRow( ); row.AddNewCell( ) .SetInnerText("Account name"); row.AddNewCell( ).AddNewInputText( ) .SetSize(40) .SetID("Text1"); // email address prompt row = main.AddNewRow( ); row.AddNewCell( ) .SetInnerText("Email address"); row.AddNewCell( ).AddNewInputText( ) .SetSize(40) .SetID("Text2"); // password prompt row = main.AddNewRow( ); row.AddNewCell( ) .SetInnerText("Password"); row.AddNewCell( ).AddNewInputText("password") .SetSize(20) .SetID("Text3"); // confirm password prompt row = main.AddNewRow( ); row.AddNewCell( ) .SetInnerText("ConfirmPassword"); row.AddNewCell( ).AddNewInputText("password") .SetSize(20) .SetID("Text4"); // "Create account" submit button row = main.AddNewRow( ); button = row.AddNewCell( ).AddNewSubmitButton( ) .SetValue("Create Account") .SetID("Button1"); button.ServerClick += new System.EventHandler(this.Button1_Click); // "cancel" submit button button = row.AddNewCell( ).AddNewSubmitButton( ) .SetValue("Cancel") .SetID("Button2"); button.ServerClick += new System.EventHandler(this.Button2_Click); // error message line. AddNewLiteralControl( ) .SetText("<br>") .SetID("Error1"); AddNewSpanControl( ) .SetID("Error2") .AddStyle("color", "red"); // apply the prompt error message text to the error message controls. ApplyPromptErrorMessage( ); }