I basically have something similar to
this tutorial. However, I wanted to add the user's first name, last name, and phone number. How do I do this with this control?
Do I have to have the profile/properties (Profile Section) in the web.config file before launching
C:\WINDOWS\Microsoft.NET\Framework\<versionNumber>\aspnet_regsql.exe or dose it matter?
Okay, I found this very nice
tutorial; however, in their sample code, I still could not figure out how they link the UserAddresses table to the aspNet_Membership table. This is their code:
mychucky
Contributor
4358 Points
3709 Posts
How to customized CreateUserWizard control?
Feb 28, 2012 08:28 PM|LINK
I basically have something similar to this tutorial. However, I wanted to add the user's first name, last name, and phone number. How do I do this with this control?
rajsedhain
Contributor
4181 Points
1041 Posts
Re: How to customized CreateUserWizard control?
Feb 28, 2012 08:59 PM|LINK
you can use custom profile provider. See this link:
http://msdn.microsoft.com/en-us/magazine/cc163457.aspx
Raj Sedhain
mychucky
Contributor
4358 Points
3709 Posts
Re: How to customized CreateUserWizard control?
Feb 29, 2012 12:21 AM|LINK
Many thanks but I'm looking for C#.
rajsedhain
Contributor
4181 Points
1041 Posts
Re: How to customized CreateUserWizard control?
Feb 29, 2012 03:04 AM|LINK
You can convert VB to C# or vice versa here:
http://www.developerfusion.com/tools/convert/vb-to-csharp/
Raj Sedhain
mychucky
Contributor
4358 Points
3709 Posts
Re: How to customized CreateUserWizard control?
Feb 29, 2012 04:40 PM|LINK
Do I have to have the profile/properties (Profile Section) in the web.config file before launching C:\WINDOWS\Microsoft.NET\Framework\<versionNumber>\aspnet_regsql.exe or dose it matter?
mychucky
Contributor
4358 Points
3709 Posts
Re: How to customized CreateUserWizard control?
Feb 29, 2012 08:05 PM|LINK
Okay, I found this very nice tutorial; however, in their sample code, I still could not figure out how they link the UserAddresses table to the aspNet_Membership table. This is their code:
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" BackColor="#FFFBD6" BorderColor="#FFDFAD" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" OnCreatedUser="CreateUserWizard1_CreatedUser"> <WizardSteps> <asp:WizardStep ID="CreateUserWizardStep0" runat="server"> <table> <tr> <th>Billing Information</th> </tr> <tr> <td>Billing Address:</td> <td> <asp:TextBox runat="server" ID="BillingAddress" MaxLength="50" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="BillingAddress" ErrorMessage="Billing Address is required." /> </td> </tr> <tr> <td>Billing City:</td> <td> <asp:TextBox runat="server" ID="BillingCity" MaxLength="50" Columns="15" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="BillingCity" ErrorMessage="Billing City is required." /> </td> </tr> <tr> <td>Billing State:</td> <td> <asp:TextBox runat="server" ID="BillingState" MaxLength="25" Columns="10" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="BillingState" ErrorMessage="Billing State is required." /> </td> </tr> <tr> <td>Billing Zip:</td> <td> <asp:TextBox runat="server" ID="BillingZip" MaxLength="10" Columns="10" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator4" ControlToValidate="BillingZip" ErrorMessage="Billing Zip is required." /> </td> </tr> </table> </asp:WizardStep> <asp:WizardStep ID="CreateUserWizardStep1" runat="server"> <table> <tr> <th>Shipping Information</th> </tr> <tr> <td>Shipping Address:</td> <td> <asp:TextBox runat="server" ID="ShippingAddress" MaxLength="50" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator5" ControlToValidate="ShippingAddress" ErrorMessage="Shipping Address is required." /> </td> </tr> <tr> <td>Shipping City:</td> <td> <asp:TextBox runat="server" ID="ShippingCity" MaxLength="50" Columns="15" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator6" ControlToValidate="ShippingCity" ErrorMessage="Shipping City is required." /> </td> </tr> <tr> <td>Shipping State:</td> <td> <asp:TextBox runat="server" ID="ShippingState" MaxLength="25" Columns="10" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator7" ControlToValidate="ShippingState" ErrorMessage="Shipping State is required." /> </td> </tr> <tr> <td>Shipping Zip:</td> <td> <asp:TextBox runat="server" ID="ShippingZip" MaxLength="10" Columns="10" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator8" ControlToValidate="ShippingZip" ErrorMessage="Shipping Zip is required." /> </td> </tr> </table> </asp:WizardStep> <asp:CreateUserWizardStep ID="CreateUserWizardStep2" runat="server"> <ContentTemplate> <table> <tr> <th>User Information</th> </tr> <tr> <td>Username:</td> <td> <asp:TextBox runat="server" ID="UserName" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator9" ControlToValidate="UserName" ErrorMessage="Username is required." /> </td> </tr> <tr> <td>Password:</td> <td> <asp:TextBox runat="server" ID="Password" TextMode="Password" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator10" ControlToValidate="Password" ErrorMessage="Password is required." /> </td> </tr> <tr> <td>Confirm Password:</td> <td> <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator13" ControlToValidate="ConfirmPassword" ErrorMessage="Confirm Password is required." /> </td> </tr> <tr> <td>Email:</td> <td> <asp:TextBox runat="server" ID="Email" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator11" ControlToValidate="Email" ErrorMessage="Email is required." /> </td> </tr> <tr> <td>Question:</td> <td> <asp:TextBox runat="server" ID="Question" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator12" ControlToValidate="Question" ErrorMessage="Question is required." /> </td> </tr> <tr> <td>Answer:</td> <td> <asp:TextBox runat="server" ID="Answer" /> <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator14" ControlToValidate="Answer" ErrorMessage="Answer is required." /> </td> </tr> <tr> <td colspan="2"> <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."></asp:CompareValidator> </td> </tr> <tr> <td colspan="2"> <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal> </td> </tr> </table> <asp:SqlDataSource ID="InsertExtraInfo" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>" InsertCommand="INSERT INTO [UserAddresses] ([UserId], [BillingAddress], [BillingCity], [BillingState], [BillingZip], [ShippingAddress], [ShippingCity], [ShippingState], [ShippingZip]) VALUES (@UserId, @BillingAddress, @BillingCity, @BillingState, @BillingZip, @ShippingAddress, @ShippingCity, @ShippingState, @ShippingZip)" ProviderName="<%$ ConnectionStrings:ASPNETDBConnectionString1.ProviderName %>"> <InsertParameters> <asp:ControlParameter Name="BillingAddress" Type="String" ControlID="BillingAddress" PropertyName="Text" /> <asp:ControlParameter Name="BillingCity" Type="String" ControlID="BillingCity" PropertyName="Text" /> <asp:ControlParameter Name="BillingState" Type="String" ControlID="BillingState" PropertyName="Text" /> <asp:ControlParameter Name="BillingZip" Type="String" ControlID="BillingZip" PropertyName="Text" /> <asp:ControlParameter Name="ShippingAddress" Type="String" ControlID="ShippingAddress" PropertyName="Text" /> <asp:ControlParameter Name="ShippingCity" Type="String" ControlID="ShippingCity" PropertyName="Text" /> <asp:ControlParameter Name="ShippingState" Type="String" ControlID="ShippingState" PropertyName="Text" /> <asp:ControlParameter Name="ShippingZip" Type="String" ControlID="ShippingZip" PropertyName="Text" /> </InsertParameters> </asp:SqlDataSource> </ContentTemplate> </asp:CreateUserWizardStep> <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server"> </asp:CompleteWizardStep> </WizardSteps> <NavigationButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" /> <HeaderStyle BackColor="#FFCC66" BorderColor="#FFFBD6" BorderStyle="Solid" BorderWidth="2px" Font-Bold="True" Font-Size="0.9em" ForeColor="#333333" HorizontalAlign="Center" /> <CreateUserButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" /> <ContinueButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" /> <SideBarStyle BackColor="#990000" Font-Size="0.9em" VerticalAlign="Top" /> <TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <SideBarButtonStyle ForeColor="White" /> </asp:CreateUserWizard>rajsedhain
Contributor
4181 Points
1041 Posts
Re: How to customized CreateUserWizard control?
Feb 29, 2012 08:25 PM|LINK
I think, they are linking via userId. If you want these things in a single table then see the another link mention in the artcile:
http://www.4guysfromrolla.com/articles/061406-1.aspx
Raj Sedhain
mychucky
Contributor
4358 Points
3709 Posts
Re: How to customized CreateUserWizard control?
Mar 01, 2012 12:42 AM|LINK
Many thanks for the help, rajsedhain. It would semed that link it by using the UserID but, how? Look at this code:
<InsertParameters> <asp:ControlParameter Name="BillingAddress" Type="String" ControlID="BillingAddress" PropertyName="Text" /> <asp:ControlParameter Name="BillingCity" Type="String" ControlID="BillingCity" PropertyName="Text" /> <asp:ControlParameter Name="BillingState" Type="String" ControlID="BillingState" PropertyName="Text" /> <asp:ControlParameter Name="BillingZip" Type="String" ControlID="BillingZip" PropertyName="Text" /> <asp:ControlParameter Name="ShippingAddress" Type="String" ControlID="ShippingAddress" PropertyName="Text" /> <asp:ControlParameter Name="ShippingCity" Type="String" ControlID="ShippingCity" PropertyName="Text" /> <asp:ControlParameter Name="ShippingState" Type="String" ControlID="ShippingState" PropertyName="Text" /> <asp:ControlParameter Name="ShippingZip" Type="String" ControlID="ShippingZip" PropertyName="Text" /> </InsertParameters>I do not see they store the UserID. So, where and when do they store the UserID in this additional table?
rajsedhain
Contributor
4181 Points
1041 Posts
Re: How to customized CreateUserWizard control?
Mar 01, 2012 01:45 PM|LINK
The
column in acts as a both a primary key for the table and as a foreign key that points to the user in the table....please read the article (section: Storing Custom User Data).and this line add the userId:
DataSource.InsertParameters.Add("UserId", UserGUID.ToString());
and see the insert statement in the DataSource.
Raj Sedhain
mychucky
Contributor
4358 Points
3709 Posts
Re: How to customized CreateUserWizard control?
Mar 01, 2012 07:53 PM|LINK
Thanks again, Rajsdhain. You're a big help. I'll take a look at that and see what hapens next.