萨瓦纳柴油自动挡:.net 请问错在哪里?

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/07 02:21:17
namespace DotNetForum
{
public class _Register: ForumPage
{
System.Web.UI.WebControls.TextBox HomePhone;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary;

System.Web.UI.WebControls.TextBox companyname;
protected System.Web.UI.WebControls.DropDownList StateDropDown;

private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
DataSet states;
FormsAuthentication.SignOut();

// bind the state drop-down combobox
states = AccountsTool.GetStates();
StateDropDown.DataSource = states;
StateDropDown.DataTextField = "Description";
StateDropDown.DataValueField = "StateCode";
StateDropDown.DataBind();
}
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.companyname.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
this.Register.Click += new System.EventHandler(this.Register_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Register_Click(object sender, System.EventArgs e)
{
// 根据用户的输入建立一个新帐号 DotNetForums.Accounts_Business.User newUser = new DotNetForums.Accounts_Business.User();
newUser.Password = ForumsPrincipal.EncryptPassword( Password.Text );
newUser.EmailAddress = EmailAddress.Text;
newUser.Address1 = Address1.Text;
newUser.Address2 = Address2.Text;
newUser.City = City.Text;
newUser.State = StateDropDown.Items[StateDropDown.SelectedIndex].Value;
newUser.ZipCode = ZipCode.Text;
newUser.HomePhone = HomePhone.Text;
newUser.FirstName = FirstName.Text;
newUser.LastName = LastName.Text;
newUser.companyname = companyname.Text;
C:\Inetpub\wwwroot\DotNetForum\Modules\Users\Register.aspx.cs(110): 不可访问“DotNetForums.Accounts_Business.User.companyname”,因为它受保护级别限制
请问错在哪?以上是其中大部分代码

以你给出的程序代码看来是newUser.companyname = companyname.Text这句有问题.其原因应该在DotNetForums.Accounts_Business.User类中companyname成员/属性(我不知道你用的是成员还是属性)的保护级别没有声明为public