I think you've got sume fundamental ASP.NET mix-ups going on.
<button
is a HTML tag. Any events it triggers must be javascript. Javascript will always be a client-side call. The onclick
attribute refers to a javascript function.
<asp:Button
is a ASP.Net control. It's OnClick
event will refer to a C#
method in your code-behind (your .cs
file) and C# methods are always server-side. <asp:Button
also has an OnClientClick
attribute that refers to a javascript method.
Answer:
<asp:Button ID="someControlName" runat="server" CssClass="login-button" OnClick="login_Click" > Login </asp:Button>
Note that you can also use the shorthand property Text=""
to combine the closing tag.
Also, Login control and Membership
One last thing. I see that you are doing some stuff pertaining to logins? Have you read about ASP.Net's Login
control specifically for this purpose? There is a lot of information that already exists pertaining to users. You should also look into ASP.Net Membership. There is a lot of information for a young ASP.Net developer to learn, but it is definitely worth the trouble.