The
UserName is used by the SqlMembershipProvider to look up information
for a particular member. While the provider model does not offer the means of changing
the UserName, the Membership Manager Control installs a Stored Procedure (if it
can) that is used to extend the provider with this much-needed functionality.
The
Change User Name View provides options for changing the login name for the currently selected user.
As illustrated, the view displays the current user name above the heading and includes a text box for entering the new User Name.
The "OK" button submits the changes while the "Cancel" button returns you to the
Summary View without committing your change.
User Name must be unique
As you may expect, the UserName must be unique within the current web application and therefore you will receive an error message if you attempt to enter a duplicate user name.
Customizing the view (design time)
The Heading Text and User Name prompt may be modified by changing the
ChangeUserNameTitle and
ChangeUserNamePrompt properties in the Visual Studio 2005 Properties pane.
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.
Database Dependency
As outlined in the
database configuration topic,
the Membership Manager control will automatically create the required stored procedure
if it can. If you are using SQL Server 2005 express (in user instance mode), the
control should be able to do this since it runs with elevated database privileges.
If your web application connects to an "attached" database, then you may have to
run a SQL Script and give permissions to the account that is accessing the database.
Related Topics
Membership Manager Help System
Reference Home