ASP.NET, Events, and C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    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
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。



  • Michael Nemtsev [MVP]

    #2
    Re: ASP.NET, Events, and C#

    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>


    Comment

    • Stan

      #3
      Re: ASP.NET, Events, and C#

      On 15 Jul, 01:56, "Nathan Sokalski" <njsokal...@hot mail.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...@hotm ail.comhttp://www.nathansokal ski.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

      Comment

      • Cowboy \(Gregory A. Beamer\)

        #4
        Re: ASP.NET, Events, and C#

        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


        or just read it:


        *************** *************** **************
        | Think outside the box! |
        *************** *************** **************
        "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
        news:uWHqjWh5IH A.3784@TK2MSFTN GP06.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
        njsokalski@hotm ail.com
        有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

        >

        Comment

        Working...