我正在尝试从一个类访问另一个类。我试图从这个问题中得到帮助,但它是在其他方面。我有一个基类如下:
public class BasePage : System.Web.UI.Page
{
public int MemberUserId
{
get
{
MembershipUser user = Membership.GetUser();
if (user != null)
{
string memberUserId = user.ProviderUserKey.ToString();
CustomerBL clientsBL = new CustomerBL ();
Customers customer = CustomerBL .GetCustomer(memberUserId);
int customerId = customer .CustomerId;
return customerId;
}
return 0;
}
}
}
我想让 customerId 进入这个类,如下所示:
public partial class showCustomer : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
LoadCustomerProfile();
}
}
LoadCustomerProfile()
{
BasePage basePage;
int customerId = basePage.customerId; //intellisense is not showing option of customerId
}
}
当我输入 basePage.customerId 时,intellisense 不显示 customerId 并在我强制输入时出错。如果有人帮助我,我会很高兴的。:)