我使用了一些访问文本的变体,StreetNbrtxt
包括
1) Directly: Profile.StreetNbr = StreetNbrtxt.Text; (Didn't work)
2) Using FindControl: Profile.StreetNbr = ((TextBox)RegisterUserWizardStep.FindControl("StreetNbrtxt")).Text; ('Not a instantiated class' Error message)
此外,我无法看到我在文本框中添加的值,这些文本框被添加到 Visual Studio Express 2012 的 Account 文件夹中的预编码文件中。
我从 Register.aspx 获得的代码如下:
<asp:CreateUserWizard runat="server" ID="RegisterUser" ViewStateMode="Disabled" OnCreatedUser="RegisterUser_CreatedUser" ActiveStepIndex="0">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="wizardStepPlaceholder" />
<asp:PlaceHolder runat="server" ID="navigationPlaceholder" />
</LayoutTemplate>
<WizardSteps>
<asp:CreateUserWizardStep runat="server" ID="RegisterUserWizardStep">
<ContentTemplate>
<p class="message-info">
Passwords are required to be a minimum of <%: Membership.MinRequiredPasswordLength %> characters in length.
</p>
<p class="validation-summary-errors">
<asp:Literal runat="server" ID="ErrorMessage" />
</p>
<fieldset>
<legend>Registration Form</legend>
<ol>
<p>
<asp:Label runat="server" AssociatedControlID="UserName">User name</asp:Label>
<asp:TextBox runat="server" ID="UserName" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="UserName"
CssClass="field-validation-error" ErrorMessage="The user name field is required." />
</p>
:
:
:
:
:
<p>
<asp:Label ID="StreetNumberlbl" runat="server" AssociatedControlID="StreetNbrtxt">Street Number:</asp:Label>
<asp:TextBox ID="StreetNbrtxt" runat="server" CssClass="style11"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="StreetNbrtxt"
CssClass="failureNotification" ErrorMessage="A street address number is required" ToolTip="Please insert your home address number"
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</p>
</ol>
<asp:Button runat="server" CommandName="MoveNext" Text="Register" />
</fieldset>
</ContentTemplate>
关于我应该如何从用户输入文本框中访问街道号码的任何想法?