Showing posts with label ProgressBar. Show all posts
Showing posts with label ProgressBar. Show all posts

Check the Username Available During Progress Bar Show Using Javascript in Asp.Net C#

Check the Username Available During Progress Bar Show Using Javascript


Username Enter The Textbox Check Available Show Progress Bar Open PArticular Interval Time Using Javascript in Asp.Net C#. 

Username Check Without ProgressBar

                                DEMO



                    Download Coding
                         
                                       Download


                      HTML CODING


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>      
     <script type="text/javascript">      
         var Time = 03, check = null;
         var Time1 = 03, check1 = null;
         function ExistUser()
         {          
             check = setInterval(starttimer, 1000);
         }
         function AvailUser()
         {
             check1 = setInterval(endTimer, 1000);
         }       
         function starttimer()
         {
             Time -= 1;
           
             if (Time <= 0)
             {
                 clearInterval(check);
                 check = null;
                 Time = 0;

                 document.getElementById('<%=Image1.ClientID%>').style.display = "none";
                 var lbl1 = document.getElementById('<%=Label1.ClientID%>');
                 lbl1.innerText = "Already Exists";               
              
             }                      
         }               
         function endTimer()
         {
             Time1 -= 1;

             if (Time1 <= 0)
             {
                 clearInterval(check1);
                 check1 = null;
                 Time1 = 0;

                 document.getElementById('<%=Image1.ClientID%>').style.display = "none";
                 var lbl1 = document.getElementById('<%=Label1.ClientID%>');
                 lbl1.innerText = "Available Username";              
           }
       }
       </script>        
    </head>
<body>
    <form id="form1" runat="server">
    <div>         
             
        <table><tr><td>
     <asp:Label ID="Label2" runat="server" Text="Username"></asp:Label>
            </td><td>
        <asp:TextBox ID="txtUsername" runat="server" AutoPostBack="True"

            OnTextChanged="txtUsername_TextChanged" ></asp:TextBox>       
                        </td><td>     
      
                        <asp:Label ID="Label1" runat="server" ForeColor="#CC3300" ></asp:Label>
            </td></tr>
            <tr><td class="auto-style1"></td><td class="auto-style1">
        <asp:Image ID="Image1" runat="server" Width="123px" Height="183px" Visible="False" />
                </td></tr>
        </table>  
           </div>       
    </form>
</body>

</html>


                                 C# CODING



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class Default6 : System.Web.UI.Page
{
    SqlConnection con;
    SqlCommand cmd;
    SqlDataAdapter adp;
    SqlDataReader rd;
    string query;


    public void dbcon()
    {
        string connn = (System.Configuration.ConfigurationManager.ConnectionStrings["dbcon"].ToString());
        con = new SqlConnection(connn);
        con.Open();

    }
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }
  
    protected void txtUsername_TextChanged(object sender, EventArgs e)
    {
        dbcon();
        query = "select username from register";
        cmd = new SqlCommand(query, con);
        rd = cmd.ExecuteReader();
        while (rd.Read())
        {
            Label1.Text = "";         
            if (rd["username"].ToString() == txtUsername.Text.ToString())
            {        
                Image1.Visible = true;
                Image1.ImageUrl = "Progress1.gif";
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "ExistUser();", true);
                break;
            }
        else           
                {                    
                    Image1.Visible = true;
                    Image1.ImageUrl = "Progress.gif";
                    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script1", "AvailUser();", true);
                
                }          
           
        }
    }
     

}



First - Create New Web Form - Select Textbox,Image From ToolBox - Image visible=False





Next - Add JavaScript Function  For Intervel Set Image Display   After Show  Textbox Message="Already Exists"






Next - Add JavaScript Function  For Intervel Set Image Display   After Show  Textbox Message="Available Username"






Next - Double Click - TextBox - Add Coding For Username Check - if Available Call Javascript Available Interval or Else Part Work.







Progress Bar Open Login Button Click in C# Window Application

Progress Bar Open Login Button Click


Progress Bar Open WhenEver Click Button Load  The Progress Bar Particular Interval After go To Next Form Using C# Window Application.

                           DEMO 




           
                             C# CODING


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace WindowsFormsApplication2
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
           
        }
       

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "A" && textBox2.Text == "A")
            {
                progressBar1.Visible = true;

                timer1.Enabled = true;
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar1.PerformStep();

            if (Convert.ToInt32(progressBar1.Value) == 100)
            {
               timer1.Enabled = false;

               Home h = new Home();
               h.Show();
            }
        }
        private void Login_Load(object sender, EventArgs e)
        {
            Login frm = new Login();
            frm.FormBorderStyle = FormBorderStyle.FixedDialog;
            frm.StartPosition = FormStartPosition.CenterScreen;
            progressBar1.Visible = false;

        }         
                                
    }
}


First Add The New Form - Select Labels & Textbox & Progress Bar & timer From ToolBox





Next - Set - Progress Bar Property






Next - Set  To Timer Control Enable & Open the Progress Bar






Next -  Run[F5] - Login Form Open





Next - Login Button Click  - Progress Bar Loading