Exemplo n.º 1
0
 protected void TextBox1_TextChanged(object sender, EventArgs e)
 {
     localhost.Service1 s = new localhost.Service1();
     if (Regex.IsMatch(TextBox1.Text, "^[a-z0-9]{5,}$"))
     {
         int respval = s.UserCheck(TextBox1.Text);
         if (respval == 1)
         {
             userun.InnerText   = "*Username is not available";
             userun2.InnerText  = "";
             HiddenField1.Value = "0";
         }
         else
         {
             userun2.InnerText  = "*Username available";
             userun.InnerText   = "";
             HiddenField1.Value = "1";
         }
     }
     else if (TextBox1.Text == "")
     {
         userun.InnerText   = "";
         userun2.InnerText  = "";
         HiddenField1.Value = "0";
     }
     else
     {
         userun.InnerText   = "*Username should have only lowercase alphanumerics(min 5)";
         userun2.InnerText  = "";
         HiddenField1.Value = "0";
     }
 }
Exemplo n.º 2
0
 protected void TextBox1_TextChanged(object sender, EventArgs e)
 {
     localhost.Service1 s = new localhost.Service1();
     if (TextBox1.Text != "")
     {
         int respval = s.UserCheck(TextBox1.Text);
         if (respval == 0)
         {
             userun.InnerText = "*Username does not exist";
         }
         else
         {
             userun.InnerText    = "";
             Session["username"] = TextBox1.Text;
             string    sec   = s.Fetch(TextBox1.Text);
             string [] secqa = sec.Split('~');
             Session["question"] = secqa[0];
             Session["answer"]   = secqa[1];
             TextBox1.Visible    = false;
             TextBox3.Text       = secqa[0];
             TextBox3.Visible    = true;
             TextBox4.Visible    = true;
         }
     }
     else
     {
         userun.InnerText = "";
     }
 }