Working with the Address Book Web Part

The Address Book Web Part lets shoppers create new addresses and edit or delete existing addresses. Shoppers can designate addresses as shipping or billing addresses, as well as primary and secondary addresses. Both shipping and billing addresses are grouped in the list. Shoppers can display shipping addresses only, billing addresses only, or both.

By default, most of the fields and messages on the Address Book Web Part are stored as Web Part property values.

Field labels are based on the locale and culture of the form.

Architecture

The Address Book Web Part contains the following components:

  • AddressDetailWebPart/SPAddressListWebPart. This component dynamically loads the AddressList user control.

  • AddressList.ascx: This is a base user control that shows a list of saved user addresses. Users can filter this list based on the address type. Users are allowed to edit or delete addresses in the list.

  • ReadOnlyAddressDetail.ascx. This user control uses a Model View Presenter (MVP) design pattern, used to display address properties in read-only mode.

The following table lists and describes the properties for the Address Book Web Part.

Property

Maps to

Type

Description

Default

"Action" URL parameter

ActionQueryParameter

string

Defines the name of query string variable used for passing action (Edit or delete).

act

"Add new address" button text

ButtonAddNewAddressText

String

Defines the text for add new address button.

Add New Address

"Address Detail" page URL

AddressDetailHeaderText

String (virtual path to the page)

A reference to the url of the address detail page

~home/MyAccount/Pages/addressDetail.aspx

"Address Id" URL parameter

AddressIdQueryParameter

String

Defines the name of query string variable used for passing address id to product detail page.

address

"Address list" section title text

AddressListHeaderLiteral

String

Sets the text displayed above the address list.

My Address Book

"Back" button text

ButtonBackText

String

Sets the text displayed on the "back" button.

Back to

"Billing addresses list" text

ListBillingAddressesText

String

Sets the text displayed for billing addresses.

Billing addresses

"City" label text

CityLabelText

String

Sets the label for the field “City”

*City

"Country" label text

CountryLabelText

String

Sets the label for the field “Country”

*Country

"Default billing address" check box text

DefaultBillingAddressCheckBoxText

String

Sets the la label “Default billing address” check box

Mark as default billing address

"Default shipping address" check box text

DefaultShippingAddressCheckBoxText

String

Sets the label “Default shipping address” check box

Mark as default shipping address

"Delete confirmation" pop-up text

DeleteConfirmationMessage

String

Sets the text displayed on the delete confirmation pop-up.

Confirm Address Deletion

"Edit" button text

ButtonEditText

String

Not functional

Not applicable

"Is billing address" check box text

BillingAddressCheckBoxText

String

Not functional

Not applicable

"Is shipping address" check box text

ShippingAddressCheckBoxText

String

Not functional

Not applicable

"Line 1" label text

Line1LabelText

String

Not functional

Not applicable

"Line 2" label text

Line2LabelText

String

Not functional

Not applicable

"Phone number" label text

PhoneNumberLabelText

String

Not functional

Not applicable

"Postal code" label text

PostalLabelText

String

Not functional

Not applicable

"Province" label text

ProvinceLabelText

String

Not functional

Not applicable

"Remove" button text

ButtonRemoveText

String

Not functional

Not applicable

"Shipping addresses" list text

ListShippingAddressesText

String

Not functional

Not applicable

"State" label text

StateLabelText

String

Not functional

Not applicable

"View" label text

ViewAddressesLabelText

String

Not functional

Not applicable

"Zip code" label text

ZipLabelText

String

Not functional

Not applicable

Instructional text

InstructionTextLiteral

String

Sets the text block displayed below the title. Can be used to provide instructions to end users.

Click the 'Add New Address' button to add to your address book.

Layout : # of columns

RepeatColumns

int

Sets the number of columns to use when laying out the collection of addresses.

The number of columns of addresses to display (if there are more addresses than columns, new rows are created as needed)

1

Layout : Orientation

RepeatDirection

Enum

Sets the orientation of the "columns" when laying out the collection of addresses.

Horizontal

User Control name

UserControlName

String

Sets the Url of the user control markup this webpart going to use

AddressDetails.ascx

The following table lists the field length limits of the Address Book Web Part.

Field

Maximum length

Line1

60

Line2

60

City

40

Postal/zip code

10

Telephone

20

The following table lists the field validation defaults of the Address Book Web Part.

Field

Regular expression

Validation message

Postal code

[A-Z]\d[A-Z]\s\d[A-Z]\d

Postal code wrong format

Zip code

\d{5}(-\d{4})?

Zip code wrong format

Customization

You can customize the Address Book Web Part by modifying the ASCX file.

Dd452068.alert_caution(en-us,CS.95).gifImportant Note:

If you make modifications to the ASCX file to customize a Web Part, rename the modified ASCX file to avoid the risk of overwriting your Web Part customizations during an upgrade.

Error Handling

There is no design-time error handing required for this Web Part.

API Dependencies

The Address Book Web Part is dependent on the UserProfile API. Addresses are related to a profile and, therefore, are retrieved by using QueryRelatedItem<Address>.

See Also

Other Resources

Developing with SharePoint Commerce Services

Address Detail Web Part

Developing with Profiles System Web Parts