Solved

CreateUserWizardControl - how to exit and display error

Posted on 2014-02-11
1
247 Views
Last Modified: 2014-02-24
Hi

I have a CreateUserWizard control which is highly customised

On this void:
 protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
    {

Open in new window


I want to call another void called checkAuthorisedEmployeeNumber

    void checkAuthorisedEmployeeNumber(string EmpNo) { 
    
        if (EmpNo == "123456"){
            //user not allowed to register
            //exit the create user wizard and show error message
            
        }

    }

Open in new window


This is working, but i want to cancel the createUser process and show an error message saying that the user isn't in the authorised list, and cannot register

Can someone help with this code please
0
Comment
Question by:websss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 39854588
1: Make your checkAuthorisedEmployeeNumber return bool: true or false
2: Set e.Cancel accordingly
3: Set the errorMessage

bool checkAuthorisedEmployeeNumber(string EmpNo) { 
    
        if (EmpNo == "123456"){
            return false; //employee not allowed to create account
         }
         return true; // by default allow to create the account
    }

protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
{
     if(checkAuthorisedEmployeeNumber(EmpNo) ==false)
     {
             SomeErrorLabel.Text = "You are not allowed to create an account"
             e.Cancel = true;
     }
}

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
asp.net web app 3 59
asp.net, radiobuttonlist, c# 3 69
Easiest intro into .NET CORE? 2 34
Content of a read only textbox are not being saved in table in asp.net - VB 5 36
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question