📄 registerform.cs
字号:
namespace ASPNET.StarterKit.Communities {
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
//*********************************************************************
//
// RegisterForm Class
//
// Represents the user registration form.
//
//*********************************************************************
public class RegisterForm : SkinnedCommunityControl {
string _skinFileName = "Users_RegisterForm.ascx";
TextBox txtUsername;
TextBox txtPassword;
TextBox txtPasswordAgain;
TextBox txtEmail;
TextBox txtFirstName;
TextBox txtLastName;
DropDownList dropTimezone;
TextBox txtOccupation;
TextBox txtLocation;
TextBox txtInterests;
TextBox txtMSN;
TextBox txtYahoo;
TextBox txtAIM;
TextBox txtICQ;
TextBox txtUrl;
TextBox txtFakeEmail;
CheckBox chkEnableNewsletter;
CheckBox chkEnableNotifications;
//*********************************************************************
//
// RegisterForm Constructor
//
// Calls the base SkinnedCommunityControl constructor
// and assigns the default page skin.
//
//*********************************************************************
public RegisterForm() : base() {
// Assign a default template name
if (SkinFileName == null)
SkinFileName = _skinFileName;
}
//*********************************************************************
//
// SkinType Property
//
// Specifies the skins directory where this page's skin file is located.
//
//*********************************************************************
override protected string SkinType {
get { return "ControlSkins"; }
}
//*********************************************************************
//
// Username Property
//
// Represents the user's username.
//
//*********************************************************************
public string Username {
get {return txtUsername.Text;}
set {
EnsureChildControls();
txtUsername.Text = value;
}
}
//*********************************************************************
//
// Password Property
//
// Represents the user's password.
//
//*********************************************************************
public string Password {
get {return txtPassword.Text;}
set {
EnsureChildControls();
txtPassword.Attributes["value"] = value;
txtPasswordAgain.Attributes["value"] = value;
}
}
//*********************************************************************
//
// Email Property
//
// Represents the user's email.
//
//*********************************************************************
public string Email {
get {return txtEmail.Text;}
set {
EnsureChildControls();
txtEmail.Text = value;
}
}
//*********************************************************************
//
// FirstName Property
//
// Represents the user's first name.
//
//*********************************************************************
public string FirstName {
get {return txtFirstName.Text;}
set {
EnsureChildControls();
txtFirstName.Text = value;
}
}
//*********************************************************************
//
// LastName Property
//
// Represents the user's last name.
//
//*********************************************************************
public string LastName {
get {return txtLastName.Text;}
set {
txtLastName.Text = value;
EnsureChildControls();
}
}
//*********************************************************************
//
// Timezone Property
//
// Represents the user's time zone.
//
//*********************************************************************
public int Timezone {
get {return Int32.Parse(dropTimezone.SelectedItem.Value);}
set {
EnsureChildControls();
dropTimezone.SelectedIndex = -1;
dropTimezone.Items.FindByValue(value.ToString()).Selected = true;
}
}
//*********************************************************************
//
// Occupation Property
//
// Represents the user's occupation.
//
//*********************************************************************
public string Occupation {
get {return txtOccupation.Text;}
set {
EnsureChildControls();
txtOccupation.Text = value;
}
}
//*********************************************************************
//
// Location Property
//
// Represents the user's location.
//
//*********************************************************************
public string Location {
get {return txtLocation.Text;}
set {
EnsureChildControls();
txtLocation.Text = value;
}
}
//*********************************************************************
//
// Interests Property
//
// Represents the user's interests.
//
//*********************************************************************
public string Interests {
get {return txtInterests.Text;}
set {
EnsureChildControls();
txtInterests.Text = value;
}
}
//*********************************************************************
//
// MSN Property
//
// Represents the user's MSN Instant Messenger Account.
//
//*********************************************************************
public string MSN {
get {return txtMSN.Text;}
set {
txtMSN.Text = value;
EnsureChildControls();
}
}
//*********************************************************************
//
// Yahoo Property
//
// Represents the user's Yahoo Instant Messenger Account.
//
//*********************************************************************
public string Yahoo {
get {return txtYahoo.Text;}
set {
txtYahoo.Text = value;
EnsureChildControls();
}
}
//*********************************************************************
//
// AIM Property
//
// Represents the user's AIM Instant Messenger Account.
//
//*********************************************************************
public string AIM {
get {return txtAIM.Text;}
set {
EnsureChildControls();
txtAIM.Text = value;
}
}
//*********************************************************************
//
// ICQ Property
//
// Represents the user's ICQ Instant Messenger Account.
//
//*********************************************************************
public string ICQ {
get {return txtICQ.Text;}
set {
EnsureChildControls();
txtICQ.Text = value;
}
}
//*********************************************************************
//
// Url Property
//
// Represents the URL of the user's Web site.
//
//*********************************************************************
public string Url {
get {return txtUrl.Text;}
set {
EnsureChildControls();
txtUrl.Text = value;
}
}
//*********************************************************************
//
// FakeEmail Property
//
// Represents the user's public email address.
//
//*********************************************************************
public string FakeEmail {
get {return txtFakeEmail.Text;}
set {
EnsureChildControls();
txtFakeEmail.Text = value;
}
}
//*********************************************************************
//
// EnableNewsletter Property
//
// Indicates whether the user wants the newsletter.
//
//*********************************************************************
public bool EnableNewsletter {
get {return chkEnableNewsletter.Checked;}
set {
EnsureChildControls();
chkEnableNewsletter.Checked = value;
}
}
//*********************************************************************
//
// EnableNotifications Property
//
// Indicates whether the user wants email notifications.
//
//*********************************************************************
public bool EnableNotifications {
get {return chkEnableNotifications.Checked;}
set {
EnsureChildControls();
chkEnableNotifications.Checked = value;
}
}
//*********************************************************************
//
// InitializeSkin Method
//
// Retrieves all the controls from the Page Skin
//
//*********************************************************************
override protected void InitializeSkin(Control skin) {
// Find the Username TextBox
txtUsername = (TextBox)GetControl(skin, "txtUsername");
// Find the Password TextBox
txtPassword = (TextBox)GetControl(skin, "txtPassword");
// Find the Password Again TextBox
txtPasswordAgain = (TextBox)GetControl(skin, "txtPasswordAgain");
// Find the Email TextBox
txtEmail = (TextBox)GetControl(skin, "txtEmail");
// Find First Name TextBox
txtFirstName = (TextBox)GetControl(skin, "txtFirstName");
// Find Last Name TextBox
txtLastName = (TextBox)GetControl(skin, "txtLastName");
// Find Timezone Dropdownlist
dropTimezone = (DropDownList)GetControl(skin, "dropTimezone");
// Find Occupation TextBox
txtOccupation = (TextBox)GetControl(skin, "txtOccupation");
// Find Location TextBox
txtLocation = (TextBox)GetControl(skin, "txtLocation");
// Find Interests TextBox
txtInterests = (TextBox)GetControl(skin, "txtInterests");
// Find MSN TextBox
txtMSN = (TextBox)GetControl(skin, "txtMSN");
// Find Yahoo TextBox
txtYahoo = (TextBox)GetControl(skin, "txtYahoo");
// Find AIM TextBox
txtAIM = (TextBox)GetControl(skin, "txtAIM");
// Find ICQ TextBox
txtICQ = (TextBox)GetControl(skin, "txtICQ");
// Find Website TextBox
txtUrl = (TextBox)GetControl(skin, "txtUrl");
// Find Fake Email TextBox
txtFakeEmail = (TextBox)GetControl(skin, "txtFakeEmail");
// Find Enable Newsletter
chkEnableNewsletter = (CheckBox)GetControl(skin, "chkEnableNewsletter");
// Find Enable Notifications
chkEnableNotifications = (CheckBox)GetControl(skin, "chkEnableNotifications");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -