0
我想在會員表中添加評論。
我說這在我的.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 = 「我TYP在我的文本框」
但是,如果我看在會員表評論爲空