I have gone through this article by Encosia and this article by Travis
and another great validator from Mosa
But here in the link and in many other articles throughout the web I have seen and they were not using user Create user wizard for checking username availability.
But I want to validated it using create user wizard?
Is there any possibility to convert this to get work with Create User Wizard?If so how can I do that?
Actually in Encosia’s example there is a code block which shows for Username_changed:
protected void Username_Changed(object sender, EventArgs e)
{
if (Membership.GetUser(Username.Text) != null)
// Display a username taken message.
else
// Display a username available message.
}
So for this how do I change according to user wizard?As in create user wizard there is no specific change event for idividual textboxes?Here I’m little bit confused 🙁 and I got one clarification with the Client ID
and I tried to modify it using javasript as
var UserName = '<%= ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).ClientID %>';
But this is not working.
From MSDN
Add an
<asp:WizardStep>element to the<WizardSteps>section of theCreateUserWizardcontrol. Include any controls and markup in the additional wizard step that your customized CreateUserWizard control will use.The following code example shows a step to be added before the
CreateUserStepof theCreateUserWizardcontrol that includes a textbox control for users to enter a user name. The user name will be checked to ensure that it does not already exist in the membership database.Add code for your wizard step. You can handle the NextButtonClick event of the Wizard control to execute your code. The CurrentStepIndex property value indicates which additional wizard step raised the NextButtonClick event by the step index number (starting from 0 for the first step).
The following code example shows a handler for the
NextButtonClickevent that takes the user name entered in the TextBox control in the wizard step from the previous code example and verifies that the user name is not blank and does not currently exist in the membership database. You will need to add an OnNextButtonClick attribute to the CreateUserWizard control on your page that references the handler for the NextButtonClick event handler (for example,OnNextButtonClick="CreateUserWizard1_NextButtonClick".)