problem using DuplicateUserNameErrorMessage

J

Jeff

Hi

ASP.NET 3.5

If a user tryes to register a username in my webproject, and that username
is already registered. Then I want the user to get an error message.

So I thought DuplicateUserNameErrorMessage was the right thing to use. But
no error messages get displayed when I enter a existing username and hit the
finish button

<asp:CreateUserWizard ID="cuwNewUser"
runat="server" AutoGeneratePassword="false"
OnCreatedUser="CreatedUser" DisableCreatedUser="true"
LoginCreatedUser="false" CreateUserButtonType="Image"
FinishCompleteButtonType="Image" DuplicateUserNameErrorMessage="tae"
FinishCompleteButtonImageUrl="~/Images/Go.gif"
CreateUserButtonImageUrl="~/Images/Go.gif" >
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server"
Title="Initial step">
<ContentTemplate>

<asp:ValidationSummary ID="ValidationSummary1"
ValidationGroup="cuwNewUser"
ShowSummary="true"
ShowMessageBox="false"
runat="server" />
</div>

<membership>
<providers>
<remove name="AspNetSqlMembershipProvider"/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=a03f5f7f11e50a3a"
connectionStringName="LocalSqlServer" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
applicationName="/" requiresUniqueEmail="true" minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"/>
</providers>
</membership>

any suggestions why no error message is displayed?
 
J

Juan T. Llibre

re:
!> any suggestions why no error message is displayed?

It seems that you don't add an ErrorMessage
container to display the Summary Validation result.

For example:

<asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>

The error message configured in DuplicateUserNameErrorMessage will be displayed there.

The CreateUserWizard must have a literal control with ID : "ErrorMessage".
This Literal will pick up all error messages on the page

In your code, DuplicateUserNameErrorMessage="tae" will display "tae" as the error message.
I assume you shortened it for brevity's sake. You should have a "regular" error message, like :

DuplicateUserNameErrorMessage="That user name already exists. Please pick a different user name."
 
J

Jeff

Yes, 'tae' is just some debug text I just entered. when I get this to work I
will replace 'tae' with a better text....

But I have already the ErrorMessage literal in the window, and still no
error message is displayed:

Below I post more of the markup of my webpage. I post it so you can see
where I have the ErrorMessage literal.

<tr>
<td style="text-align:right">Security answer:</td>
<td style="width:160px;"><asp:TextBox ID="Answer" CssClass="textbox"
runat="server" Width="100%"></asp:TextBox></td>
<td style="width:10px;">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Answer is required" ControlToValidate="Answer"
SetFocusOnError="false" Display="Dynamic" ValidationGroup="cuwNewUser">*
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="3" style="background-color:Green;">
<%--<asp:Literal ID="ErrorMessage" runat="server"
EnableViewState="False"></asp:Literal>--%>
</td>
</tr>
</table>
<asp:Literal ID="ErrorMessage" runat="server"
EnableViewState="False"></asp:Literal>
<asp:ValidationSummary ID="ValidationSummary1"
ValidationGroup="cuwNewUser"
ShowSummary="true"
ShowMessageBox="false"
runat="server" />
</div>
</ContentTemplate>

any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top