Here are the C# code snippets for the EditProfile.aspx page. This is the code for the Page_Load event handler:
if (!Page.IsPostBack) {
txtFirstName.Text = Profile.FirstName;
txtLastName.Text = Profile.LasttName;
txtAddress1.Text = Profile.Address1;
txtAddress2.Text = Profile.Address2;
txtCity.Text = Profile.City;
txtStateProvince.Text = Profile.StateProvince;
txtZipPostalCode.Text = Profile.ZIPPostalCode;
txtCountry.Text = Profile.Country;
End If
Here's the code for the Button1_Click event handler:
Profile.FirstName = txtFirstName.Text; Profile.LasttName = txtLastName.Text; Profile.Address1 = txtAddress1.Text; Profile.Address2 = txtAddress2.Text; Profile.City = txtCity.Text; Profile.StateProvince = txtStateProvince.Text; Profile.ZIPPostalCode = txtZipPostalCode.Text; Profile.Country = txtCountry.Text;
You can see the code in place in EditProfile.aspx.cs on page 186 of the book (English edition).
For Visual Basic the code is slightly different, as described on page 188. For the Page_Load event the code is:
If Not Page.IsPostBack Then
txtFirstName.Text = Profile.FirstName
txtLastName.Text = Profile.LasttName
txtAddress1.Text = Profile.Address1
txtAddress2.Text = Profile.Address2
txtCity.Text = Profile.City
txtStateProvince.Text = Profile.StateProvince
txtZipPostalCode.Text = Profile.ZIPPostalCode
txtCountry.Text = Profile.Country
End If
For the Button1_Click event it's the same as for C# but without the semicolons:
Profile.FirstName = txtFirstName.Text Profile.LasttName = txtLastName.Text Profile.Address1 = txtAddress1.Text Profile.Address2 = txtAddress2.Text Profile.City = txtCity.Text Profile.StateProvince = txtStateProvince.Text Profile.ZIPPostalCode = txtZipPostalCode.Text Profile.Country = txtCountry.Text