By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,449 Members | 1,601 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,449 IT Pros & Developers. It's quick & easy.

ASP.NET, Events, and C#

P: n/a
I am an ASP.NET developer and am trying to learn more about C# as a
codebehind language. When writing the code to handle an event, is there an
easy way to have Visual Studio 2005 automatically place the eventhandler's
signature in the code (including the parameters)? When using VB.NET, all you
had to do was select the control from the left dropdown and the event from
the right dropdown, and there you go! But C# not only makes you add an
attribute in the *.aspx file, but to the best of my knowledge, you need to
manually type the signature for the eventhandler. I would think that Visual
Studio would have added something to make implementing the events a little
bit easier. Is there something I am missing, or has Visual Studio just not
added this feature to C# yet? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jul 15 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello Nathan,

If you double click on the form control you should have the event handler
signature for them in your code behind.
Moreover, you can open property window and select which event you want to
use

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
NSI am an ASP.NET developer and am trying to learn more about C# as a
NScodebehind language. When writing the code to handle an event, is
NSthere an easy way to have Visual Studio 2005 automatically place the
NSeventhandler's signature in the code (including the parameters)?
NSWhen using VB.NET, all you had to do was select the control from the
NSleft dropdown and the event from the right dropdown, and there you
NSgo! But C# not only makes you add an attribute in the *.aspx file,
NSbut to the best of my knowledge, you need to manually type the
NSsignature for the eventhandler. I would think that Visual Studio
NSwould have added something to make implementing the events a little
NSbit easier. Is there something I am missing, or has Visual Studio
NSjust not added this feature to C# yet? Thanks.
NS>
Jul 15 '08 #2

P: n/a
On 15 Jul, 01:56, "Nathan Sokalski" <njsokal...@hotmail.comwrote:
I am an ASP.NET developer and am trying to learn more about C# as a
codebehind language. When writing the code to handle an event, is there an
easy way to have Visual Studio 2005 automatically place the eventhandler's
signature in the code (including the parameters)? When using VB.NET, all you
had to do was select the control from the left dropdown and the event from
the right dropdown, and there you go! But C# not only makes you add an
attribute in the *.aspx file, but to the best of my knowledge, you need to
manually type the signature for the eventhandler. I would think that Visual
Studio would have added something to make implementing the events a little
bit easier. Is there something I am missing, or has Visual Studio just not
added this feature to C# yet? Thanks.
--
Nathan Sokalski
njsokal...@hotmail.comhttp://www.nathansokalski.com/
Hi Nathan

As a former VB coder (where events are exposed via the drop-down list
at the top of the code editor) you may not be aware that the propeties
window has two views (I know it took me a while to find it) one for
properties and one for events..

Look at the top of the properties window and among the buttons you'll
see one with a sort of lightning strike icon. Click that an you see a
list of events instead of properties. Click on any entry and the code
outline for the chosen event will be created automatically. To go back
to properties view click the button to the left of the events view
button (one which looks like a two column page of text).

HTH
Jul 15 '08 #3

P: n/a
Two ways I can think of

1. Double click on the control - this is very useful for the default event
handler (click for button, etc.)
2. Click on the control in design and go to the properties window. Click on
the lightning bolt and find the event you wish to handle. Type in a handler
and it will be created for you.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:uW**************@TK2MSFTNGP06.phx.gbl...
>I am an ASP.NET developer and am trying to learn more about C# as a
codebehind language. When writing the code to handle an event, is there an
easy way to have Visual Studio 2005 automatically place the eventhandler's
signature in the code (including the parameters)? When using VB.NET, all
you had to do was select the control from the left dropdown and the event
from the right dropdown, and there you go! But C# not only makes you add an
attribute in the *.aspx file, but to the best of my knowledge, you need to
manually type the signature for the eventhandler. I would think that Visual
Studio would have added something to make implementing the events a little
bit easier. Is there something I am missing, or has Visual Studio just not
added this feature to C# yet? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jul 15 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.