The underlying SqlServerMembership Provider provides an option for changing the
user's
Email Address and the
Change Email Address view is used
to tap into that capability
As illustrated, the view displays the current user name and Email Address above
the heading and includes a text box for entering the new Email.
The "OK" button submits the changes while the "Cancel" button returns you to the
Summary View without committing your change.
Email address may or may not have to be unique
Since the underlying provider is used to change the Email address, the
Membership.RequiresUniqueEmail
configuration property (web.config) will determine if the provider will allow you
to enter a duplicate Email address. By default, this property allows duplicate Email
addresses but if you have specifically set it to do so, an error message will be
displayed if you attempt to change a member's Email address to a value which duplicates
that of another member.
Customizing the view (design time)
The Heading Text and User Name prompt may be modified by changing the
ChangeEmailTitle
and
ChangeEmailPrompt properties in the Visual Studio 2005 Properties
pane. Similarly, you can specify the label that should be inserted into the comments upon an administrative change of Email address (
ChangeEmailComment) as well as the error message that is displayed by the built-in validation control when an invalid Email address is attempted (
EmailInvalidMessage)
While simple label and style changes might be adequate for your needs, you may also
wish to take advantage of the
Convert to Template option which exposes
the view's constituent web controls for formatting and editing.
As illustrated, the Tasks panel includes an option to select the desired view then
Convert to Template changes it to a templated panel.
Just like the Asp.Net Login Controls, templated views allow you to change the layout
and content of the panel. You actually have a lot of flexibility when doing so,
however you must not delete or change the name of the active controls such as the
text box, the OK button or the Cancel Button.
The following is an example of a panel that has been converted to a template then
customized with additional controls:
As you can see, the modified control may contain images, additional label controls
and varied formatting.
Control properties do not apply to templated views
When you convert a view to a templated view, the constituent controls are created
using the current properties which have been set (styles, text, etc.) The next time
you refresh the page, you may notice that properties related to the now-templated
view are no longer listed in the Visual Studio 2005 Properties pane. This
is by design and it is assumed that you will be setting properties on the controls
themselves.
If you want to discard your templated changes, just bring up the tasks menu and
click the
Reset option as illustrated below. Caution: Reset will immediately
discard any changes you have made to your custom view template. Of course, nothing
is permanent until you save the file.