0

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> 

나는 세 가지 이벤트에 샘플 코드를 삽입 : 나는 그러나 사용자 이름과 암호는 모두 세 가지 이벤트에 빈 문자열을 반환, Page_Load 이벤트에서 제목 속성을 검색 할 수 있어요

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; 
    } 

. 왜 이런거야? 어떻게 이러한 값을 검색 할 수 있습니까?

답변

0

OnCreatedUser 이벤트를 통해 같은 것을 가져 오십시오.

관련 문제