Click here to Skip to main content
15,791,520 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 project when ever i try to click on my bootstrap theme when designing button it does not take me to the 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 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>

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());
          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
Updated 27-Apr-19 13:29pm

1 solution

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

Pick one name.
Share this answer
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