Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:53:04+00:00 2026-05-23T12:53:04+00:00

I am using Create User control with my own sql server database, I am

  • 0

I am using Create User control with my own sql server database, I am not sure what event is there which can indicate the create user control to show its Duplicate UserName Error Message if there is an existing Username or email.

Please let me know.

thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:53:04+00:00Added an answer on May 23, 2026 at 12:53 pm

    If you were using aspnet membership then CreateUser Control would have done the work itself. But from your question I guess you are not using so. In this case you will have to use logic to check for existing username. You can use Custom Validator and create a server side validation with it.

    Example:
    .aspx

    <asp:TextBox ID="txtUserName" runat="server" MaxLength="150"></asp:TextBox>
    <asp:CustomValidator ID="CustomValidator1" runat="server" OnServerValidate="CustomValidator1_ServerValidate"
     ControlToValidate="txtUserName" Display="Dynamic"
     ErrorMessage="UserName Already Exists" 
     ToolTip="Please select a different UserName" ValidationGroup="Register">
    </asp:CustomValidator>
    

    The code behind can have:

    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            SqlCommand objcmd = new SqlCommand("Select * from Login_Table where UserName='" + args.Value + "'",con);
            SqlDataReader objReader;
            con.Open();
            objReader = objcmd.ExecuteReader();
    
            if (objReader.HasRows)
            {
                args.IsValid = false;
            }
            else {
                args.IsValid = true;
            }
            con.Close();
        }
    
    protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
    // your registration code
    }
    

    Remember to keep the submit button under the same Validation Group as the Custom Validator i.e. “Register” in this case. You can have the control inside ajax update panel further. Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a user control, which can be bound to some data
How can I create a local user account using .NET 2.0 and c# and
I am trying to create a user interface using XAML. However, the file is
Using reflection, I need to investigate a user DLL and create an object of
I created a program using dev-cpp and wxwidgets which solves a puzzle. The user
I am attempting to write a 'User Control' in WinForms .NET (not ASP.NET). The
I've a custom property on a user control which has multiple state/modes. If this
Trying to build my own user control: <%@ Control Language=C# AutoEventWireup=true CodeFile=TabMenu.ascx.cs Inherits=TabMenu %>
I have an app built using Visual Studio 2005, which can run rpt files.
I created my own parental control app using C# to monitor my kids activity.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.