Hello Friends I got this Error:
Compiler Error Message: 'ASP.login_aspx' does not contain a definition for 'LoginBtn_Click' and no extension method 'LoginBtn_Click' accepting a first argument of type 'ASP.login_aspx' could be found (are you missing a using directive or an assembly reference?)
Source Error:
<asp:Button ID="LoginBtn" ValidationGroup="LoginValidation"
runat="server" Text="Login" onclick="LoginBtn_Click"/><br />
I have a definition for 'LoginBtn_Click'.
Aspx Page Coding
<asp:Button ID="LoginBtn" ValidationGroup="LoginValidation"
runat="server" Text="Login" onclick="LoginBtn_Click"/>
Aspx.cs Page Coding
protected void LoginBtn_Click(object sender, EventArgs e)
{
string ConnectionString = ConfigurationManager.ConnectionStrings["BankDatabaseConnectionString"].ConnectionString;
DataSet myset = new DataSet();
try
{
using (SqlConnection con = new SqlConnection(ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("Select * from Users where Email=@User_ID and Password=@Password", con))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add(new SqlParameter("@User_ID", SqlDbType.VarChar, 200));
cmd.Parameters["@User_ID"].Value = UserIdtxt.Text;
cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 15));
cmd.Parameters["@Password"].Value = Passwordtxt.Text;
con.Open();
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
sda.Fill(myset);
}
}
}
if (myset.Tables[0].Rows.Count > 0)
LabelMsg.Text = "Login Successful!";
else
LabelMsg.Text = "Incorrect Credentials!";
}
catch (Exception ex)
{
LabelMsg.Text = "Exception Occured while Saving: " + ex.Message;
}
}
}
Please check it out and help me to resolve this.
What I have tried:
I deleted the LoginBtn_Click Event in aspx.cs Page and Created a New Click Event,but again I got this Error