ASP.NetのメンバシップとCreateUserWizardを使用すると、Passoword、UserName、ConfirmPasswordなどの値をコードで取得できないことに気づきました。拡張拡張プロパティをretieveできます。ASP.Net C#CreateUserWizardユーザー名、パスワードのプロパティ
可能であれば、UserNameなどを取得することをお勧めします。以下にサンプルコードを掲載しました。フィールドが記入され、ポストバックされると、私はPassword、ConfirmPassword、Email、およびUserNameを参照することができますが、受け取った値は空の文字列です。 Titleフィールドの値に到達することができます。タイトルフィールドはではないので、空の文字列を返します。以下のコードはサブセットのみです。
<asp:CreateUserWizard ID="UserRegistration" runat="server"
onload="UserRegistration_Load" onprerender="UserRegistration_PreRender">
<WizardSteps>
<asp:CreateUserWizardStep ID="UserRegistrationStep_1" runat="server">
<ContentTemplate>
<asp:Label ID="lblUserName" runat="server" Text="User Name"></asp:Label>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:Label ID="lblEMail" runat="server" Text="EMail"></asp:Label>
<asp:TextBox ID="EMail" runat="server"></asp:TextBox>
<asp:Label ID="lblPassword" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="Password" runat="server"></asp:TextBox>
<asp:Label ID="lblConfirmPassowrd" runat="server" Text="Confirm Password"></asp:Label>
<asp:TextBox ID="ConfirmPassowrd" Text="1234567" runat="server"></asp:TextBox>
<asp:Label ID="lblTitle" runat="server" Text="Title"></asp:Label>
<asp:TextBox ID="Title" Text="Title1234567" runat="server"></asp:TextBox>
<asp:PlaceHolder ID="Captcha" runat="server" />
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="UserRegistrationStep_2" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
私は、3つの異なるイベントのサンプルコードを配置:私はしかし、ユーザ名とパスワードは、すべての3つのイベントで空の文字列を返し、Page_LoadイベントにTitleプロパティを取得することができる午前
protected void Page_Load(object sender, EventArgs e)
{
string s0 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("Password")).Text;
string s1 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("Title")).Text;
string s2 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).Text;
string s = s0+ s1 + s2;
}
protected void UserRegistration_Load(object sender, EventArgs e)
{
string s0 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("Password")).Text;
string s1 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("Title")).Text;
string s2 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).Text;
string s = s0 + s1 + s2;
}
protected void UserRegistration_PreRender(object sender, EventArgs e)
{
string s0 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("Password")).Text;
string s1 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("Title")).Text;
string s2 = ((TextBox)UserRegistration.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).Text;
string s = s0 + s1 + s2;
}
。どうしてこれなの?これらの値はどのように取得できますか?