我想在会员表中添加评论。
我在我的 .aspx 代码中添加了这个:
<asp:CreateUserWizard ID="Register" runat="server" OnCreatedUser="RegisterUserWithRoles_CreatedUser">
<CreateUserButtonStyle />
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
<ContentTemplate>
<table>
<td align="right">
<asp:Label ID="RoomLabel" runat="server" AssociatedControlID="Room">Room number:</asp:Label>
</td>
<td>
<asp:TextBox ID="Room" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RoomRequired" runat="server" ControlToValidate="Room"
ErrorMessage="Room number is required." ToolTip="Room number is required."
ValidationGroup="Register">*</asp:RequiredFieldValidator>
</td>
...
这是我的 aspx.cs 代码:
protected void RegisterUserWithRoles_CreatedUser(object sender, EventArgs e)
{
TextBox comment=
(TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Comment");
Membership.GetUser(Register.UserName).Comment = comment.Text ;
}
}
如果我调试comment.Text =“我在我的文本框中输入的内容”
但是如果我查看成员资格表评论为空