If you are like me, you probably find it a pain in C#'s partial classes that you gotta manually type the private void Page_Load(object source, EventArgs e){ } stub. Anyways, not like this is magic, but if you aren't familiar with expansions, goto: C:\Program
Files\Microsoft Visual Studio 8\VC#\Expansions\1033\Expansions Create a file called "PageLoad.xml" and put this in it: OnLoad Page Load Method Stub Expansion SurroundsWith
You can now simply type OnLoad and the stub will be written. If anyone know how to use the supposedly existing section of expansions, plz let me know.
Thanks this is a nice trick. I do not understand either why the IDE support for adding events in VB is easier than in C#. But I found that in the December CTP version the folder is now: C:\<....wherever...>\Microsoft Visual Studio 8\VC#\Snippets\1033\Snippets
And I had to change the XML file a little bit to: PageLoad Page Load Method Stub Expansion SurroundsWith
In visual studio, wouldn't double clicking on the web form in design view add this? Not using asp.net 2.0 yet but I'm pretty sure I saw this somewhere.
Shouldn't there be a WebForm or Asp.net snippets group? There is one for WinForms etc.
Beyond Page_Load there are other missing snippets such as the other events Page_Init etc.
Member
1 Points
39 Posts
Page_Load event
Aug 19, 2004 07:37 PM|elemental|LINK
You can now simply type OnLoad and the stub will be written. If anyone know how to use the supposedly existing section of expansions, plz let me know.
None
0 Points
13 Posts
Re: Page_Load event
Dec 25, 2004 12:09 PM|tw_|LINK
Microsoft MVP - Windows Mobile Devices
None
0 Points
87 Posts
Re: Page_Load event
Mar 10, 2005 02:37 PM|TheLomex|LINK
Contributor
4696 Points
5308 Posts
MVP
Re: Page_Load event
Mar 10, 2005 02:44 PM|Fredrik N|LINK
MVP, ASPInsider, WCF RIA Services Insider
My Blog
Member
20 Points
33 Posts
Re: Page_Load event
Oct 24, 2005 01:55 PM|willc|LINK
Shouldn't there be a WebForm or Asp.net snippets group? There is one for WinForms etc.
Beyond Page_Load there are other missing snippets such as the other events Page_Init etc.
Member
660 Points
494 Posts
Re: Page_Load event
Oct 27, 2005 11:04 AM|nicequy|LINK
override <SPACE> onload
but....this is my preference, [;)]
Jason