Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day everyone please i am having challenges to have a button click event in my asp.net project when ever i try to click on my bootstrap theme when designing button it does not take me to the asp.net webform eg(default.aspx.cs) instead it takes me to the default.aspx. so i am unable to write my code under the button without using the asp.net drag and drop button.

What I have tried:

<button ID="btnlogin" class="btn btn-primary btn-block btn-flat"  type="submit" runat="server" oneserverclick="btnlogin_onClick" >Sign In</button>
                    </div>


this code is not working. i want whereby whenever i click on the button it makes something like this
protected void btnlogin_Click(object sender, EventArgs e)
    {

where i can write code like this
protected void btnlogin_Click(object sender, EventArgs e)
      {
          SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["loginConnectionString1"].ToString());
          con.Open();
          string query = "select count (*) from log where username ='" + txtuser.Text + "' and password ='" + txtpass.Text + "' ";
          SqlCommand cmd = new SqlCommand(query, con);
          string output = cmd.ExecuteScalar().ToString();

for registration and other codes
Posted
Updated 27-Apr-19 12:29pm
v3

1 solution

If your "button" calls "btnlogin_onClick", then the code cannot be called "Unnamed1_Click".

Pick one name.
 
Share this answer
 
Comments
akinwunmi 27-Apr-19 18:30pm    
i was just giving an example

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900