How can I create or/and navigate to an event handler for a server control in vs2005?
-
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. -
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. -
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.
-
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.
-
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.
-
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.
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
-
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
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.
-
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.
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.