Programming an ASP.NET AJAX Server-Centric Based Online Shopping Website - Running Time
(Page 2 of 4 )
The following Figure 7 shows the running time snapshot relating to the above page.
Figure 7—the running-time snapshot when users register
/Building_ASP.NET_AJAX_Server-Centric_Shopping_Website(3)_html_m261b432c.png)
For brevity, we’ve only "decorated" three ASP.NET TextBox controls in Figure 7 with the above three extender controls. Any user who has had a few desktop application experiences will appreciate this kind of web application design mode—it drastically enhances the user experience!
When the registering user clicks the "OK" button the related click event handler SureBtn_Clickis triggered. Note herein we temporarily save the registration information into one of the important browser-side variables, namedSession, and then redirect the user to another page, "CommitRegister.aspx," where he can really submit his registration information to the remote web server.
For the convenience of using Session, we’ve defined a helper class, UserInfo, which encapsulates all the detailed data that he just entered. The following code gives more detail:
public class UserInfo{
public string UserName;
public string RealName;
public string Password;
public string Address;
public string Email;
public string Phone;
public string Mobile;
public string Remark;
public readonly static string UserIDString = "USERINFO";
}
Let’s examine the code of the above event handler:
protected void SureBtn_Click(object sender,EventArgs e) {
User user = new User();
UserInfo userInfo = new UserInfo();
userInfo.UserName = UserName.Text;
userInfo.RealName = RealName.Text;
userInfo.Password = Password.Text;
userInfo.Address = Address.Text;
userInfo.Phone = Phone.Text;
userInfo.Email = Email.Text;
userInfo.Mobile = Mobile.Text;
userInfo.Remark = Remark.Text;
Session[Session.SessionID + UserInfo.UserIDString] = userInfo;
Response.Redirect("~/Desktop/CommitRegister.aspx");
}
Surely, there’s nothing peculiar, is there? Now let’s continue looking at the page on which the registration is finished. The following Figure 8, shown in the next section, gives the related runtime snapshot of the "CommitRegister.aspx" page.
Next: Registration >>
More ASP.NET Articles
More By Xianzhong Zhu