There are lots of new features there in visual studio 2012. Event handler generation is one of them. In earlier version of visual studio there was no way to create event handler from source view directly. Now visual studio 2012 have event handler generation functionality.
So if you are editing an event view in source view intellisense will display add new event handler template and once you click on it. It will create a new event handler in the cs file. It will also put a eventhandler name against event name so you don’t need to write that.
So, let’s take a simple example of button click event so once I write onclick attribute their smart intellisense will pop up
.
![Event handler generation in visual studio 2012- What's new in visual studio 2012 Event handler generation in visual studio 2012 - What's new in visual studio 2012](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIFHS6XSTi4beQ8rVmlWOScuC-yn5WOXcaQ6Cb7Xi6uPO12FBJD6_Dygzej_5etg1nEukurhRzFE2AYaQXJXHo5-8fafgJHPUgXRPCvs30_39tKUSR2r1d1XtGcbqhsAr-axuryZxGXnQ/?imgmax=800)
Now once you click on <Create New Event> It will create event handler in .cs file like following.
![Event Handler in asp.net with visual studio 2012 - What's new in visual studio 2012 Event Handler in asp.net with visual studio 2012 - What's new in visual studio 2012](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzhn7yx_gLczOxFUTGtiZoPKGtosS7EqFXSoD5yHEGHnaZk8W7Eur7eFqc4H39XODKI3a64lK6nWtWQ25mX8MRyNtNZiRPxh2CcyjMoOMhoHPUU37lF8tgtbR1z5nhYyePISB_MS9Z5vA/?imgmax=800)
It will also put submitButton_Click on onClick attribute.
![Create event new handler in visual studio 2012 - new feature of visual studio 2012 Create event new handler in visual studio 2012 - new feature of visual studio 2012](//lh6.ggpht.com/-1x0i5I1s2Nw/T_Mwpex5tLI/AAAAAAAABbQ/tXJ6xHVsiPo/ButtonClickVisualStudio2012_thumb%25255B9%25255D.png?imgmax=800)
So if you are editing an event view in source view intellisense will display add new event handler template and once you click on it. It will create a new event handler in the cs file. It will also put a eventhandler name against event name so you don’t need to write that.
So, let’s take a simple example of button click event so once I write onclick attribute their smart intellisense will pop up
.
Now once you click on <Create New Event> It will create event handler in .cs file like following.
It will also put submitButton_Click on onClick attribute.
![Create event new handler in visual studio 2012 - new feature of visual studio 2012 Create event new handler in visual studio 2012 - new feature of visual studio 2012](http://lh6.ggpht.com/-1x0i5I1s2Nw/T_Mwpex5tLI/AAAAAAAABbQ/tXJ6xHVsiPo/ButtonClickVisualStudio2012_thumb%25255B9%25255D.png?imgmax=800)