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 8272389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:06:46+00:00 2026-06-08T07:06:46+00:00

I was using an ASP.NET Wizard control for adding new users to the web-based

  • 0

I was using an ASP.NET Wizard control for adding new users to the web-based application that I developed. Everything works well and fine. Now, I got a new requirement from the Admin of the system which is sending an email notification to the new user telling him that he has been added to the system. I added the Mail function to my code and it works. Now, after clicking on the Finished button on the Wizard, the user will be added to the database and the system will send an email notification to the user, then the wizard will show me the Success message. However, sometimes it takes a long time until the system sending that email to the user and the wizard showing me the Success message.

So How I can display a (Please Wait ) screen/PopUp during the time that the system is working on sending that email to the user?

Code-Behind with Mail function:

 protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {

        string username = TextBox1.Text;

        if (!String.IsNullOrEmpty(radio1.SelectedValue) && !String.IsNullOrEmpty(username))
        {
            string connString = "Data Source=localhost;Initial Catalog=TestDB;Integrated Security=True";

            string insertUserCommand = "INSERT INTO employee (Name, Username, JobTitle, BadgeNo, EmpOrgType, DivisionCode) values (@Name, @Username, @JobTitle, @BadgeNo, @EmpOrgType, @DivisionCode)";
            string cmdText = "SELECT Count(*) FROM employee WHERE Username = '" + username + "'";
            using (SqlConnection conn = new SqlConnection(connString))
            {
                conn.Open();
                // Open DB connection.
                using (SqlCommand cmd = new SqlCommand(cmdText, conn))
                {
                    if ((int)cmd.ExecuteScalar() == 0){

                        SqlCommand cmd2 = new SqlCommand(insertUserCommand, conn);
                        cmd2.Parameters.AddWithValue("@Name", user.Name);
                        cmd2.Parameters.AddWithValue("@Username", username);
                        cmd2.Parameters.AddWithValue("@JobTitle", jobTitle);
                        cmd2.Parameters.AddWithValue("@BadgeNo", EmpNo.));
                        cmd2.Parameters.AddWithValue("@EmpOrgType", orgType);
                        cmd2.Parameters.AddWithValue("@DivisionCode", orgCode);
                        cmd2.ExecuteNonQuery();
                    }

                }
            }

            //For updating the role of the user
            string deleteCommand = "DELETE FROM UserRole where Username=@Username";
            string insertCommand = "INSERT INTO UserRole (RoleID,Username) values(@RoleID,@Username)";
            using (SqlConnection conn = new SqlConnection(connString))
            {
                conn.Open();
                //using (SqlCommand cmd = new SqlCommand(cmdText, conn))
                using (SqlCommand cmd = new SqlCommand(deleteCommand, conn))
                {
                    cmd.Parameters.AddWithValue("@Username", username);
                    cmd.ExecuteNonQuery();
                    //Now the insert
                    cmd.CommandText = insertCommand;
                    cmd.Parameters.Clear(); 
                    cmd.Parameters.AddWithValue("@RoleID", radio1.SelectedValue);
                    cmd.Parameters.AddWithValue("@Username", username);
                    cmd.ExecuteNonQuery();
                    //infoSpan.InnerText = String.Format("The users role has been updated to - {0}", radio1.SelectedValue);
                    //cmd.ExecuteScalar();
                    //infoSpan.InnerText = String.Format("The users role has been updated to - {0}", radio1.SelectedValue);
                }
            }

            Wizard1.Visible = false;
            wizard.InnerHtml = @"<p><b>The task has been done successfully.</b> <br /> <a href='UserManagement.aspx'>Edit Another User</a></p>";
        }

        SendEmailToUser(username);

    }
/*****************************************************/


    protected void SendNotificationByEmail(string toAddresses, string fromAddress, string MailSubject, string MessageBody, bool isBodyHtml)
    {
        SmtpClient sc = new SmtpClient("MailAddress");
        try
        {
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress("test@mailAddress.com", "Test Sys");


            msg.Bcc.Add(toAddresses);
            msg.Subject = MailSubject;
            msg.Body = MessageBody;
            msg.IsBodyHtml = isBodyHtml;
            sc.Send(msg);
        }
        catch (Exception ex)
        {
            throw ex;
        }

    }

    protected void Send(string username)
    {
        string connString = "Data Source=localhost;Initial Catalog=TestDB;Integrated Security=True";

        string networkID = username.ToString();

        using (SqlConnection conn = new SqlConnection(connString))
        {
            var sbEmailAddresses = new System.Text.StringBuilder(2000);

            //initiate the varibles that will be retreived from the database
            string name = null;

            // Open DB connection.
            conn.Open();

            string cmdText2 = @"SELECT     Name
                                FROM       dbo.employee
                                WHERE     (Username = @networkID)";
            using (SqlCommand cmd = new SqlCommand(cmdText2, conn))
            {
                cmd.Parameters.AddWithValue("@networkID", networkID);
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        name = reader["Name"].ToString();
                        sbEmailAddresses.Append(username).Append("@mailAddress.com");
                    }
                }

                //var sEMailAddresses = sbEmailAddresses.ToString();
                string body = @"...........................";
                SendNotificationByEmail(sbEmailAddresses.ToString(), "", "Welcome...", body, true);
                sbEmailAddresses.Clear();
                reader.Close();


            }

            conn.Close();
        }
    }
  • 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-06-08T07:06:48+00:00Added an answer on June 8, 2026 at 7:06 am

    If your application uses an UpdatePanel, you can use the UpdateProgress control to show whatever you want while the request is processing.

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

Sidebar

Related Questions

We are using a .net wizard control for a mobile website. Everything works great
I want to hide the Next button on my ASP.NET Wizard control using JavaScript.
i have read somewhere about using layout template in asp.net wizard control but when
I am creating a web application using Form Authentication of Asp.Net with C# and
I'm using this article to convert my ASP.NET 2.0 web application to an ASP.NET
I'm using ASP.NET, and in a Wizard control I have radio buttons where if
Has anyone successfully used the AJAX-enabled ASP.NET Web Application wizard in Delphi 2007 to
I have an MVC web application in asp.net 3.5 How can I convert that
I am using an ASP.NET wizard control for editing the role of the user
as you have seen before we have asp.net wizard componant for web application Is

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.