【发布时间】:2014-08-23 16:54:55
【问题描述】:
我正在编写一个页面来收集用户信息(姓名、地址、信用卡信息等)以进行结帐。该页面有一个 ASP.net 向导控件,并假定用户已登录到他们的网站用户帐户。 Page_Load() 包含以下代码:
// Get the user
MembershipUser user = Membership.GetUser(User.Identity.Name);
// Get the user's profile
ProfileCommon Profile = (ProfileCommon)ProfileCommon.Create(user.UserName);
FirstName.Text = Profile.FirstName;
LastName.Text = Profile.LastName;
OrganizationName.Text = Profile.OrganizationName;
Address1.Text = Profile.Address1;
Address2.Text = Profile.Address2;
City.Text = Profile.City;
State.Text = Profile.State;
ZipCode.Text = Profile.ZipCode;
Country.Text = Profile.Country;
Telephone.Text = Profile.Telephone;
Fax.Text = Profile.Fax;
Email.Text = user.Email;
这成功地将用户信息加载到向导的第一步。但是,如果用户更改任何文本框中的文本并单击“下一步”进入下一步,然后单击“上一步”返回到第一步,则页面会从 Page_Load() 重新加载用户信息。有什么好的方法可以防止这种行为并在这些文本框中保留更改的文本?
【问题讨论】:
-
搞定了。谢谢。
-
请标记我的答案,谢谢