I’m a computer science student, and I’m in Web Applications right now. I know how to create an event in a WinForm (you just double-click whatever you want to make an event with) and I just don’t know how to do it in a web form. I’m using Visual Studio 2012. say this is my control:
<asp:Button ID="playButton" runat="server" Text="Play" />
How do I create an event in the Form1.aspx.cs class?
You can just attach the event handler yourself, rather than using the IDE to attach the event for you, regardless of what type of environment you’re in:
Where
myEventHandleris a method that is of the proper signature. If you type the above code Visual Studio will also provide an option to automatically generate a method of the appropriate signature for you if one does not already exist.