Mike Simo

Mike Simo

  • NA
  • 17
  • 12.4k

form and enter key on keybord

Jun 8 2014 8:29 AM
Hi 
i have many form in my website but the enter key on my keyboard its not working with those forms as since i click on enter key its just show the same form until i click on the form btn to processing the login process

 public partial class login : System.Web.UI.Page
    {

        string sc = ConfigurationManager.ConnectionStrings["BeravaConnectionString"].ConnectionString.ToString();
        
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Loginbtn_Click(object sender, EventArgs e)
        {
                SqlConnection log = new SqlConnection(ConfigurationManager.ConnectionStrings["BeravaConnectionString"].ConnectionString);
    log.Open();
    string checkuser = "Select count(*) from UserInfo where UID='" + usrnamlogintxtbx.Text + "'";
    SqlCommand cmd = new SqlCommand(checkuser, log);
    int temp = Convert.ToInt32(cmd.ExecuteScalar().ToString());

           
    log.Close();

   

    if (temp == 1)
    {
        log.Open();
        string checkpasswordquery = "Select Password from UserInfo where  UID='" + usrnamlogintxtbx.Text + "'";
        SqlCommand passcom = new SqlCommand(checkpasswordquery, log);
        string password = passcom.ExecuteScalar().ToString().Replace(" ","");


        if (password == usrnamloginpassbx.Text)
        {
            Session["UsrNme"] = usrnamlogintxtbx.Text;
            Response.Redirect("User panel.aspx");
        }
    
    else
    {
        passwronglbl.Text = "Password is incorrect";
    }
    }

        else {

        wronglogusernamelbl.Text = "Invalid User Name";
        }

    }

     
    }

    } 

   


Answers (1)