Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess to custom field in user registration wizard
    primarykey
    data
    text
    <p>I have created a simple CreateUserWizard to register my users. I've added 2 TextBox : LastName and FirstName.</p> <p>Now, I would like to add them in my database when the user is registrated. Here is what I've done :</p> <pre><code>&lt;asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="false" OnCreatedUser="RegisterUser_CreatedUser" RequireEmail="false"&gt; &lt;WizardSteps&gt; &lt;asp:CreateUserWizardStep ID="RegisterUserWizardStep0" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:TextBox ID="LastName" runat="server" &gt;&lt;/asp:TextBox&gt; [...] &lt;asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="S'inscrire" ValidationGroup="RegisterUserValidationGroup"/&gt; </code></pre> <p>And in the .cs file :</p> <pre><code> protected void RegisterUser_CreatedUser(object sender, EventArgs e) { TextBox test = RegisterUser.FindControl("LastName") as TextBox; // Or using the generated ID TextBox test2 = RegisterUser.FindControl("MainContent_RegisterUser_CreateUserStepContainer_LastName") as TextBox; } </code></pre> <p>But whatever I try, my TextBox is always <code>null</code>...</p> <p>Did I miss something ? How could I get the value of these TextBox ?</p> <p><strong>Edit :</strong> This solution worked for me :</p> <pre><code>(TextBox)RegisterUser.WizardSteps[0].FindControl("CreateUserStepContainer").FindControl("LastName"); </code></pre> <p>The only problem is I found the container name "CreateUserStepContainer" by using the debugger...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload