473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1088
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
6
by: Saso Zagoranski | last post by:
Hi! How can I unregister all the events registered to a control? I have seen a piece of code in another thread, which gets all the registered handlers for a specific event. Let's say I have a...
14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
2
by: Bob Rundle | last post by:
I have the following code, which appears to be working. However it doesn't look right. The part I am wondering about is the logic in DisconnectEvents(). This logic creates a new delegate and...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
30
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment...
5
by: Richard Maher | last post by:
Hi, Here I mean "User" in the Programmer or Javascript sense. I merely wish to programmatically trigger an Event. It would be absolutely fantastic if there was a (Form level?) ONUSEREVENT() and...
14
by: xoozlez | last post by:
Hi there, I have a registration form where I like to filter out the past events of 2007. This is the code I am using : strSQL = "SELECT EventID, EventName, EventDateBegin, EventDateEnd,...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.