jag har följt en guide på denna sida http://aspnet.4guysfromrolla.com/articles/070506-1.aspx men får det inte att fungera. Jag försöker infoga mer info om medlemmen i samband med registrering. Min kod ser ut så här.Problem med CreateWizarduser
<code>
<%@ Page Language="C#" Theme="goldenSkin" MasterPageFile="~/goldenMaster.master"
AutoEventWireup="true" CodeFile="addUser.aspx.cs" Inherits="admin_addUser" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="layInfo">
<table>
<tr>
<td>
<h1>
Lägg till medlem</h1>
</td>
</tr>
<tr>
<td>
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" MailDefinition-BodyFileName="~/textFiles/welcome.txt"
AutoGeneratePassword="true" MailDefinition-From="92hallberg@telia.com" MailDefinition-Subject="Du är nu medelm!">
<WizardSteps>
<asp:WizardStep ID="CreateUserWizardStep0" runat="server">
<table>
<tr>
<td>
Förnamn:</td>
<td>
<asp:TextBox ID="txtFName" runat="server" />
<asp:RequiredFieldValidator ID="rfvName" runat="server" ErrorMessage="Förnamn krävs!"
ControlToValidate="txtFName" />
</td>
</tr>
<tr>
<td>
Efternamn:</td>
<td>
<asp:TextBox ID="txtLName" runat="server" />
<asp:RequiredFieldValidator ID="rfvLName" runat="server" ErrorMessage="Efternamn krävs!"
ControlToValidate="txtLName" />
</td>
</tr>
<tr>
<td>
Adress:</td>
<td>
<asp:TextBox ID="txtAddress" runat="server" />
<asp:RequiredFieldValidator ID="rfvAddress" runat="server" ErrorMessage="Adress krävs!"
ControlToValidate="txtAddress" />
</td>
</tr>
<tr>
<td>
Postnr:</td>
<td>
<asp:TextBox ID="txtZipCode" runat="server" />
<asp:RequiredFieldValidator ID="rfvZipCode" runat="server" ErrorMessage="Postnummer krävs!"
ControlToValidate="txtZipCode" />
</td>
</tr>
<tr>
<td>
Stad:</td>
<td>
<asp:TextBox ID="txtCity" runat="server" />
<asp:RequiredFieldValidator ID="rfvCity" runat="server" ErrorMessage="Stad krävs!"
ControlToValidate="txtCity" />
</td>
</tr>
<tr>
<td>
Telefon:</td>
<td>
<asp:TextBox ID="txtPhone" runat="server" /></td>
</tr>
<tr>
<td>
Mobil:</td>
<td>
<asp:TextBox ID="txtCellPhone" runat="server" /></td>
</tr>
</table>
</asp:WizardStep>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" 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>
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="addExtraInfo" runat="server" ConnectionString="<%$ ConnectionStrings:MyMembershipConnString %>"
InsertCommandType="StoredProcedure" InsertCommand="addMember" ProviderName="System.Data.SqlClient">
<InsertParameters>
<asp:ControlParameter Name="fName" Type="String" ControlID="txtFName" PropertyName="Text" />
<asp:ControlParameter Name="lName" Type="String" ControlID="txtLName" PropertyName="Text" />
<asp:ControlParameter Name="address" Type="String" ControlID="txtAddress" PropertyName="Text" />
<asp:ControlParameter Name="zipCode" Type="String" ControlID="txtZipCode" PropertyName="Text" />
<asp:ControlParameter Name="city" Type="String" ControlID="txtCity" PropertyName="Text" />
<asp:ControlParameter Name="phone" Type="String" ControlID="txtPhone" PropertyName="Text" />
<asp:ControlParameter Name="cellPhone" Type="String" ControlID="txtCellPhone" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</td>
</tr>
</table>
</div>
<asp:Label ID="Label1" runat="server" Text="Label">Du är inlagd!</asp:Label>
</asp:Content>
</code>
Och code behind ser ut så här:
<code>
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
TextBox UserNameTextBox = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");
SqlDataSource DataSource = (SqlDataSource)CreateUserWizardStep1.ContentTemplateContainer.FindControl("addExtraInfo");
MembershipUser User = Membership.GetUser(UserNameTextBox.Text);
object UserGUID = User.ProviderUserKey;
DataSource.InsertParameters.Add("UserId", UserGUID.ToString());
DataSource.Insert();
}
</code>
Det fungerar att registrera sig som medlem, men det blir inget insatt i min nya tabell. Jag använder som ni ser en lagrad procedur till det och den fungerar.