此代码有问题吗?无法弄明白一夜!
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
{
string email2 = Membership.GetUser(User.Identity.Name).Email;
MembershipUser currentUser = Membership.GetUser();
string UserId2 = currentUser.ProviderUserKey.ToString();
TextBox2.Text = email2;
TextBox3.Text = UserId2;
}
它说必须有返回类型。
答案 0 :(得分:8)
我想到了三件事:
If
语句应为if
- C#区分大小写答案 1 :(得分:3)
试试这个:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string email2 = Membership.GetUser(User.Identity.Name).Email;
MembershipUser currentUser = Membership.GetUser();
string UserId2 = currentUser.ProviderUserKey.ToString();
TextBox2.Text = email2;
TextBox3.Text = UserId2;
}
}