views:

417

answers:

3

When you edit a simple page in the design view you can add an event on most components by simply doubleclicking the relevant event in the design view, which does the binding and generates the function declaration in the codebehind for you.

In larger projects where the pages are complex, the design vew can be extremely slow. Is there a way to quickly generate the codebehind stubs directly from the aspx source?

+1  A: 

I've been able to do this with ReSharper, but I've been using it for so long that I don't recall whether Visual Studio has this capability natively.

John Saunders
Ok, that makes sense. I'm sure I've seen it "in action" but it could have been a plugin. If ReSharper can do it then that is a valid solution.
Console
A: 

You could create your own snippet

http://stackoverflow.com/questions/117508/create-custom-code-snippet-in-visual-studio-2008

Greg B
A: 

Hi

In the markup view the Properties window is still available, you may have it hidden.

When it's shown and the cursor is in the markup for a particular control, you get that control's properties and events like you would in Design view, so similarly in the event tab you can double click the event (i.e Click) to automatically generate an empty decloration in code and hook up the event without ever having to go into Design view.

Does that help?

Mark
In my case the properties window only lists a few properties and events in the markup view. For an asp:button for example, it doesn't list "onClick".
Console