Need help on CreateUserWizard control.

L

Learner

Hello,
I have defined another textbox control in the CreateUserWizard
control and this is how I am trying to get the value of it in the code
behind page is below

im myStep As CreateUserWizardStep = New CreateUserWizardStep
Dim DealerShipIDvalue As TextBox =
myStep.ContentTemplateContainer.FindControl("_txtDealerShipID")
Dim dealer As String
dealer = Server.HtmlEncode(DealerShipIDvalue.Text)


I am not sure the way I am trying to get the value of _txtDealerShipID
is right but this is the error I am getting


***********************************************************
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="App_Web_8ftjgxfz"
StackTrace:
at Registar.CreateUserWizard1_CreatedUser(Object sender,
EventArgs e) in C:\Documents and Settings\devi\My Documents\Visual
Studio 2005\WebSites\AppDevTraining\DataSource\Register.aspx.vb:line 12
at
System.Web.UI.WebControls.CreateUserWizard.OnCreatedUser(EventArgs e)
at
System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser()
at
System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs
e)
at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source,
EventArgs e)
at
System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source,
EventArgs e)
at
System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object
source, EventArgs args)
at System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs
e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

***********************************************************

Could some one please help me here.

Thanks
-L
 
M

Mantorok

If the control is a server-control you can access it directly by it's Id -
you don't need to "find" it.

ie txtDealerShipID.Text = "blah blah"

Kev
 
L

Learner

This the customized CreateUserWizard

************************************************************************************************************
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Register.aspx.vb" Inherits="Registar" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Register<br />
<br />
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
ContinueDestinationPageUrl="~/Default.aspx">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1"
runat="server">
<ContentTemplate>
<table border="0">
<tr>
<td align="center" colspan="2">
Sign Up for Your New Account</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="right">
<asp:Label ID="EmailLabel"
runat="server" AssociatedControlID="Email">E-mail:</asp:Label></td>
<td>
<asp:TextBox ID="Email"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="EmailRequired" runat="server" ControlToValidate="Email"
ErrorMessage="E-mail is
required." ToolTip="E-mail is required."
ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="QuestionLabel"
runat="server" AssociatedControlID="Question">Security
Question:</asp:Label></td>
<td>
<asp:TextBox ID="Question"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="QuestionRequired" runat="server" ControlToValidate="Question"
ErrorMessage="Security question
is required." ToolTip="Security question is required."

ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="AnswerLabel"
runat="server" AssociatedControlID="Answer">Security
Answer:</asp:Label></td>
<td>
<asp:TextBox ID="Answer"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="AnswerRequired" runat="server" ControlToValidate="Answer"
ErrorMessage="Security answer
is required." ToolTip="Security answer is required."

ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="_lblDealerShipID"
runat="server" Text="Dealer Ship ID :"></asp:Label></td>
<td>
<asp:TextBox ID="_txtDealerShipID"
runat="server"></asp:TextBox></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>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
&nbsp;&nbsp;

</div>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Default.aspx">Home</asp:HyperLink><br />
</form>
</body>
</html>
************************************************************************************


Am I missing some there here?

-L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top