Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How can I create or/and navigate to an event handler for a server control in vs2005?

How can I create or/and navigate to an event handler for a server control in vs2005?

Scheduled Pinned Locked Moved ASP.NET
questionvisual-studiodesignsysadminperformance
11 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Carolina
    wrote on last edited by
    #1

    Hi! I am getting up to speed working with web development in vs 2005 and I'm missing a feature in the VS environment. When working in design mode with a page, I want to have easy access to create delegates for any event available in my custom server controls, but I can not find anything of the kind. (I also want easy navigation to the code once I've implemented it.) The events for any regular (predefined) web control are available as expected, but not the ones I define in my own controls. I get the feeling I'm missing something in my code, since I can find no way to get the controls to appear in the Toolbox either. I've created the controls using Add new Item, choosing the Web User Control template. Does anyone have any ideas as to what I might be doing wrong? Or this this a (undocumented) feature (read: bug) in the new development environment?

    Carolina Berglund
    Consultant, systemdeveloper and architect.

    M 1 Reply Last reply
    0
    • C Carolina

      Hi! I am getting up to speed working with web development in vs 2005 and I'm missing a feature in the VS environment. When working in design mode with a page, I want to have easy access to create delegates for any event available in my custom server controls, but I can not find anything of the kind. (I also want easy navigation to the code once I've implemented it.) The events for any regular (predefined) web control are available as expected, but not the ones I define in my own controls. I get the feeling I'm missing something in my code, since I can find no way to get the controls to appear in the Toolbox either. I've created the controls using Add new Item, choosing the Web User Control template. Does anyone have any ideas as to what I might be doing wrong? Or this this a (undocumented) feature (read: bug) in the new development environment?

      Carolina Berglund
      Consultant, systemdeveloper and architect.

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      How to: Create Event Handlers in ASP.NET Web Pages[^]

      C 1 Reply Last reply
      0
      • M minhpc_bk

        How to: Create Event Handlers in ASP.NET Web Pages[^]

        C Offline
        C Offline
        Carolina
        wrote on last edited by
        #3

        Yeah, this is what I am missing, but the problem is I don't have the events symbol mentioned in point 2...

        Carolina Berglund Consultant, systemdeveloper and architect.

        M 1 Reply Last reply
        0
        • C Carolina

          Yeah, this is what I am missing, but the problem is I don't have the events symbol mentioned in point 2...

          Carolina Berglund Consultant, systemdeveloper and architect.

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Are you viewing the web page in Design View or Source View?

          C 1 Reply Last reply
          0
          • M minhpc_bk

            Are you viewing the web page in Design View or Source View?

            C Offline
            C Offline
            Carolina
            wrote on last edited by
            #5

            It's in design view I miss this feature

            M 1 Reply Last reply
            0
            • C Carolina

              It's in design view I miss this feature

              M Offline
              M Offline
              minhpc_bk
              wrote on last edited by
              #6

              Do you select the control in the Design view?

              C 1 Reply Last reply
              0
              • M minhpc_bk

                Do you select the control in the Design view?

                C Offline
                C Offline
                Carolina
                wrote on last edited by
                #7

                Yes... I'm not noob on this, and I have already entered all code I need to make this [ie using the events I need] work, I just want to know why the user-friendly way to do it is unavailable for my custom controls. Any regular control in the framework has the events button in the Properties pane, so I'm sure there is nothing wrong with my installation or with the way I use the environment. There must be something missing in the code, but I can't find any reference to what is needed to get a custom web control to display the events pane in design mode.

                M 1 Reply Last reply
                0
                • C Carolina

                  Yes... I'm not noob on this, and I have already entered all code I need to make this [ie using the events I need] work, I just want to know why the user-friendly way to do it is unavailable for my custom controls. Any regular control in the framework has the events button in the Properties pane, so I'm sure there is nothing wrong with my installation or with the way I use the environment. There must be something missing in the code, but I can't find any reference to what is needed to get a custom web control to display the events pane in design mode.

                  M Offline
                  M Offline
                  minhpc_bk
                  wrote on last edited by
                  #8

                  If it works for all the built-in controls, but your custom control, then I also think it may be down to your code. If you don't mind and cannot find the root cause, can you post it here, I'll have a stab at it.

                  C 1 Reply Last reply
                  0
                  • M minhpc_bk

                    If it works for all the built-in controls, but your custom control, then I also think it may be down to your code. If you don't mind and cannot find the root cause, can you post it here, I'll have a stab at it.

                    C Offline
                    C Offline
                    Carolina
                    wrote on last edited by
                    #9

                    Sure, no problem. I've cleared out some of the code that references my business logic class, since you dont have access to it. This includes a public property for assigning an instance of my BL-class to the control, and this property shows up in the properties window in design mode when this control is included in a web page. This is the source for one of my ascx pages: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EducationEdit.ascx.cs" Inherits="cv_EducationEdit" %>

                    Typ

                    Utbildning

                    Institut

                    Datum

                    - - -

                    Visa vid export

                    And this is the corresponding code-behind (.cs): using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class cv_Educat

                    M 1 Reply Last reply
                    0
                    • C Carolina

                      Sure, no problem. I've cleared out some of the code that references my business logic class, since you dont have access to it. This includes a public property for assigning an instance of my BL-class to the control, and this property shows up in the properties window in design mode when this control is included in a web page. This is the source for one of my ascx pages: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EducationEdit.ascx.cs" Inherits="cv_EducationEdit" %>

                      Typ

                      Utbildning

                      Institut

                      Datum

                      - - -

                      Visa vid export

                      And this is the corresponding code-behind (.cs): using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class cv_Educat

                      M Offline
                      M Offline
                      minhpc_bk
                      wrote on last edited by
                      #10

                      Hi there, Ahh web user control, historically VS 2003 does not support displaying the custom properties/events of a web user control .ascx in Properties windows and Intellisense is not provided in the Html view (now is the Source View in VS 2005). And when the VS 2005 comes out, there are a couple of improvoments like displaying the custom preperties in the Properties windows, and the Intellisens is also supported in the Html view. However, it still does not support adding the event handler for a web user control from the Properties windows. That being said, your choices are to add the handler in the Source view then manually add the source for the handler or you can add in code behind for example in the InitializeComponent method and have VS 2005 generate the method implementation.

                      C 1 Reply Last reply
                      0
                      • M minhpc_bk

                        Hi there, Ahh web user control, historically VS 2003 does not support displaying the custom properties/events of a web user control .ascx in Properties windows and Intellisense is not provided in the Html view (now is the Source View in VS 2005). And when the VS 2005 comes out, there are a couple of improvoments like displaying the custom preperties in the Properties windows, and the Intellisens is also supported in the Html view. However, it still does not support adding the event handler for a web user control from the Properties windows. That being said, your choices are to add the handler in the Source view then manually add the source for the handler or you can add in code behind for example in the InitializeComponent method and have VS 2005 generate the method implementation.

                        C Offline
                        C Offline
                        Carolina
                        wrote on last edited by
                        #11

                        Well then, now we're on the same page :) Too bad this functionality is not provided for web controls. :sigh: As I search my memory I am no longer certain I've worked with events in web user controls before, though I have so extensively in windows controls. I just assumed there was no difference in the design environment... One more item on the wish list then :-D

                        Carolina Berglund Consultant, systemdeveloper and architect.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups