467,926 Members | 1,463 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

Need help on CreateUserWizard control.

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("_txtD ealerShipID")
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.a spx.vb:line 12
at
System.Web.UI.WebControls.CreateUserWizard.OnCreat edUser(EventArgs e)
at
System.Web.UI.WebControls.CreateUserWizard.Attempt CreateUser()
at
System.Web.UI.WebControls.CreateUserWizard.OnNextB uttonClick(WizardNavigationEventArgs
e)
at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source,
EventArgs e)
at
System.Web.UI.WebControls.CreateUserWizard.OnBubbl eEvent(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(Command EventArgs
e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

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

Could some one please help me here.

Thanks
-L

Apr 13 '06 #1
  • viewed: 2059
Share:
2 Replies
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

"Learner" <pr****@gmail.com> wrote in message
news:11**********************@z34g2000cwc.googlegr oups.com...
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("_txtD ealerShipID")
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.a spx.vb:line 12
at
System.Web.UI.WebControls.CreateUserWizard.OnCreat edUser(EventArgs e)
at
System.Web.UI.WebControls.CreateUserWizard.Attempt CreateUser()
at
System.Web.UI.WebControls.CreateUserWizard.OnNextB uttonClick(WizardNavigationEventArgs
e)
at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source,
EventArgs e)
at
System.Web.UI.WebControls.CreateUserWizard.OnBubbl eEvent(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(Command EventArgs
e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

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

Could some one please help me here.

Thanks
-L

Apr 13 '06 #2
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

Apr 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

By using this site, you agree to our Privacy Policy and Terms of Use.