View Single Post
  #1 (permalink)  
Old June 11th, 2009, 06:55 PM
eddiemcham eddiemcham is offline
Authorized User
Points: 112, Level: 2
Points: 112, Level: 2 Points: 112, Level: 2 Points: 112, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2008
Location: San Antonio, TX, USA.
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Default Disappearing UserName & Question within Customized PasswordRecovery Question Template

Hello,

I am new to ASP.NET and C#, but slowly getting the hang of things. That said, I've run into a bit of a puzzle that I'm hoping someone can help me with.

I have a PasswordRecovery whose templates I have customized. Long story short: I loathe the nested-table-based layout in which it comes out of the box. So except for the actual form fields and labels themselves, everything went into DIVs with CSS classes.

All that went well except for the Question Template, where the UserName and Question values (not the labels) disappear. I have Googled several sites that show how to customize the PasswordRecovery tool and consulted a couple of ASP.NET books. My templates look identical to theirs.

When reset to their default appearance, these two values reappear, but then I'm back to that hideous nested-table layout, which will interfere with our Section 508-friendly policy. So I know the cause is wrapped up somewhere inside the Add Template function.

Below is my customized code:

Code:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server">
 

<MailDefinition From="binky@somedomain.net" BodyFileName="~/App_Data/SignUpConfirmation.txt" />
<QuestionTemplate>
<div class="topbottompadding">Please answer your Secret Question.</div>
<table>
<tr>
<td class="right">User ID:</td>
<td><asp:Literal ID="UserName" runat="server"></asp:Literal></td>
</tr>
<tr>
<td class="right">Your Secret Question:</td>
<td><asp:Literal ID="Question" runat="server"></asp:Literal></td>
</tr>
<tr>
<td class="right"><asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">Answer:</asp:Label></td>
<td>
<asp:TextBox ID="Answer" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="AnswerRequired" runat="server" ControlToValidate="Answer" ErrorMessage="Answer is required." ToolTip="Answer is required." ValidationGroup="PasswordRecovery1">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
<div class="topbottompadding"><asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit" ValidationGroup="PasswordRecovery1" /></div>
<div class="topbottompadding"><span class="boldred"><asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal></span></div>
</QuestionTemplate>
<UserNameTemplate>
<div class="topbottompadding">Please enter your User ID.</div>
<table>
<tr>
<td class="right"><asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User ID:</asp:Label></td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User ID is required." ToolTip="User Id is required." ValidationGroup="PasswordRecovery1" CssClass="boldred">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
<div class="topbottompadding"><asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit" ValidationGroup="PasswordRecovery1" CssClass="button" /></div>
<div class="topbottompadding"><span class="boldred"><asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal></span></div>
</UserNameTemplate>
<SuccessTemplate>
<div class="topbottompadding"><span class="boldred">Your password has been reset and emailed to you.</span></div>
</SuccessTemplate>
</asp:PasswordRecovery>
When I reach the Secret Question page, I get the following (sans CSS formatting; problem areas highlighted red):

Reset Password

Please answer your Secret Question.
User ID:
Your Secret Question:
Answer:

Your answer could not be verified. Please try again.

Can anyone please advise me? Thanks so much.
__________________
~ Eddie McHam
Reply With Quote