I’m trying to develop some web page in Asp.Net and C# which almost look like facebook login page where user can sign in at top of the page and sign up at the bottom, how should I do that? and when the focuses are on the textboxs of sign in part and the user hit the Enter it should go to Sign in method,
I already searched in stackoverflow about it and it seems all questions which already asked were about Asp.Net MVC which I’m not using.
You can assign a single event to multiple button clicks –
I presume in your case the same logic will run for both buttons, you could find out which button was clicked using
senderargument that is passed into the function.As an example, let’s say I have an aspx page and I add a button to it called ‘Button1’ I can then add a click event via Visual Studio and it will create a methiod to handle the click event for me called
Button1_Click. The method will be automatically linked to the button as theAutoEventWireupup property in c# is set to true by default.Now, if I add a second button and call it ‘Button2’ but I want that button to fire the same event handler as the one used for Button1, I could add this code to the pages ‘Page_Load’ event handler
Button2.Click += Button1_Click;Both buttons would then cause the ‘Button1_Click’ method to run when clicked.