471,350 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

ASP.NET, Events, and C#

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
3 1571
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
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
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.

Similar topics

6 posts views Thread by Saso Zagoranski | last post: by
14 posts views Thread by JPRoot | last post: by
2 posts views Thread by Bob Rundle | last post: by
30 posts views Thread by Burkhard | last post: by
5 posts views Thread by Richard Maher | last post: by
1 post views Thread by swethak | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.