View Single Post
  #2 (permalink)  
Old October 11th, 2006, 12:52 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi jackandjo,

Glad you like the book.

I think it's pretty easy to do. Here are the first steps to get you going:

1. Add a CreateUserWizard to a page.

2. Right-click it and choose Customize Create User Step

3. In the markup that has been added, add runat="server" and visible="false" attributes to the table row that holds the box for the User Name, like this:
Code:
<tr runat="server" visible="false">
  <td align="right">
    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">
             User Name:</asp:Label>
  </td>
  <td>
    <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="UserNameRequired" 
         runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." 
         ToolTip="User Name is required." 
         ValidationGroup="CreateUserWizard1">
         *
    </asp:RequiredFieldValidator>
  </td>
</tr>
If you just remove the entire row, you'll get an error because the UserName field is required.

Then in the CreatingUser event, sync the user name and e-mail address like this:
Code:
Protected Sub CreateUserWizard1_CreatingUser(ByVal sender As Object, _
      ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs) _
      Handles CreateUserWizard1.CreatingUser
  CreateUserWizard1.UserName = CreateUserWizard1.Email
End Sub
This way, when the user is inserted, the e-mail address is inserted as the user's name.

Similar to this, you'll need to customize other controls; you mainly need to alter the labels in front of controls, similar to what's been done to the PasswordRecovery control in chapter 9 - The Web Shop.

Hope this helps and if not, please let me know.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Glass by Joy Division (Track 2 from the album: Heart And Soul (CD 1)) What's This?