Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9322563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:07:19+00:00 2026-06-19T04:07:19+00:00

I am working on a project in Microsoft Visual Studio using an ASP.NET web

  • 0

I am working on a project in Microsoft Visual Studio using an ASP.NET web application with code behind in C#. I added a CreateUserWizard and customized the form in step 1. From the events handler I put a CreatedUser handler into the codebehind to update database tables.
I want to pull the data values for the handler from the form, but the codebehind file can’t see them for some reason. Help!

Main Page

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageControls" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightBox" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="SiteControl1" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="SiteControl2" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="SiteControl3" runat="server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="CPMain" runat="server">
    <center>
        <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
CreateUserButtonText="Submit"
            RequireEmail="False" OnCreatedUser="CreateUserWizard1_CreatedUser">
            <WizardSteps>
                <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
                    <ContentTemplate>
                        <table border="0" style="font-size: 100%">
                            <tr>
                                <td align="center" colspan="2" style="font-weight: 
bold; color: white; background-color: #5d7b9d">
                                    Register with Acme!
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Label ID="Label1" runat="server" 
AssociatedControlID="UserName">
                        First Name:</asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="FName" runat="server">
</asp:TextBox>
                                    <asp:RequiredFieldValidator 
ID="RequiredFieldValidator1" runat="server" ControlToValidate="FirstName"
                                        ErrorMessage="First Name is required." 
ToolTip="First Name is required." ValidationGroup="CreateUserWizard1">*
</asp:RequiredFieldValidator>
                                </td>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="Label2" runat="server">
                        Last Name:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="LName" runat="server">
</asp:TextBox>
                                        <asp:RequiredFieldValidator 
ID="RequiredFieldValidator2" runat="server" ControlToValidate="LastName"
                                            ErrorMessage="Last Name is required." 
ToolTip="Last Name is required." ValidationGroup="CreateUserWizard1">*
</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <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>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="PasswordLabel" runat="server" 
AssociatedControlID="Password">
                        Password:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="Password" runat="server" 
TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator 
ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                            ErrorMessage="Password is required." 
ToolTip="Password is required." ValidationGroup="CreateUserWizard1">*
</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="ConfirmPasswordLabel" 
runat="server" AssociatedControlID="ConfirmPassword">
                        Confirm Password:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="ConfirmPassword" 
runat="server" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator 
ID="ConfirmPasswordRequired" runat="server" ControlToValidate="ConfirmPassword"
                                            ErrorMessage="Confirm Password is 
required." ToolTip="Confirm Password is required."
                                            ValidationGroup="CreateUserWizard1">*
</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2">
                                        <asp:CompareValidator ID="PasswordCompare" 
runat="server" ControlToCompare="Password"
                                            ControlToValidate="ConfirmPassword" 
Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
                                            ValidationGroup="CreateUserWizard1">
</asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2" style="color: red">
                                        <asp:Literal ID="ErrorMessage" runat="server" 
EnableViewState="False"></asp:Literal>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="Label3" runat="server" 
AssociatedControlID="UserName">
                        Role:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="RoleSelector" 
runat="server">
                                            <asp:ListItem 
Value="Visitor">Visitor</asp:ListItem>
                                            <asp:ListItem 
Value="Employee">Employee</asp:ListItem>
                                            <asp:ListItem Value="PM">Project 
Manager</asp:ListItem>
                                            <asp:ListItem Value="DM">Department 
Manager</asp:ListItem>
                                            <asp:ListItem Value="Director">IT 
Director</asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                        </table>
                    </ContentTemplate>
                </asp:CreateUserWizardStep>
                <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
                    <ContentTemplate>
                    </ContentTemplate>
                </asp:CompleteWizardStep>
            </WizardSteps>
        </asp:CreateUserWizard>
    </center>
</asp:Content>

CodeBehind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Principal;

namespace Acme
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {
            RolesManager.InsertEmployee(FName.Text, LName.Text, RoleSelector.Value, 
User.Identity);
        }
    }
}

I get these errors at compile time:

Error   1   The name 'FName' does not exist in the current context  C:\MV_Training\Jan2013\C#Projects\AcmePresentation\AcmePresentation\Register.aspx.cs    20  41  AcmePresentation
Error   2   The name 'LName' does not exist in the current context  C:\MV_Training\Jan2013\C#Projects\AcmePresentation\AcmePresentation\Register.aspx.cs    20  53  AcmePresentation
Error   3   The name 'RoleSelector' does not exist in the current context   C:\MV_Training\Jan2013\C#Projects\AcmePresentation\AcmePresentation\Register.aspx.cs    20  65  AcmePresentation

and this from the browser:

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: ‘ASP.register_aspx’ does not contain a definition for ‘CreateUserWizard1_CreatedUser’ and no extension method ‘CreateUserWizard1_CreatedUser’ accepting a first argument of type ‘ASP.register_aspx’ could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 16: <asp:Content ID="Content7" ContentPlaceHolderID="CPMain" runat="server">
Line 17:     <center>
Line 18:         <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
Line 19:             CreateUserButtonText="Submit" RequireEmail="False" 
Line 20:             oncreateduser="CreateUserWizard1_CreatedUser">

Source File: c:\MV_Training\Jan2013\C#Projects\AcmePresentation\AcmePresentation\Register.aspx Line: 18

Thanks,
Bill

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T04:07:21+00:00Added an answer on June 19, 2026 at 4:07 am

    You want to cast controls explicitly something like this –

    public void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
       var fNameTextBox = (TextBox)CreateUserWizardStep1
              .ContentTemplateContainer.FindControl("FName");
       var lNameTextBox = (TextBox)CreateUserWizardStep1
              .ContentTemplateContainer.FindControl("LName");
       var usernameTextBox = (TextBox)CreateUserWizardStep1
              .ContentTemplateContainer.FindControl("UserName");
    
       MembershipUser user = Membership.GetUser(usernameTextBox.Text);
       Guid userId = (Guid)user.ProviderUserKey;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Microsoft Symbol Server with Visual Studio 2008 and it's working pretty
I am working on creating a Windows Forms Application in C++ using Visual Studio
I am currently working on a project using C# and Visual Studio 2012. I
I am currently working on a c# asp.net web project and I am trying
I am at the moment working on a project on Visual Studio 2010 using
We're working on a project here in Visual Studio 2008. We're using the built-in
i am using microsoft visual studio 2010 professional for my project and involves using
I'm working on a work progress application which is based on an Microsoft Project
I'm working on a simple web project for mobile in Microsoft Webmatrix 2.0. For
I am working on a WPF project, using MVVM and Microsoft Prism libraries .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.