how do I add attributes to a server control at design time
HI all
I have created a server control that draws out a hyperlink with some extended capabilities like adding a querystring etc. The control raises an event that I handle in the containing page. I do this by adding the "onControlAdded" attribute to the server control as shown below (in bold.)
<cc1:hyperlink onControlAdded="Bindit" runat="server" text="Shopping Cart" navigateurl="shoppingcart.aspx" enableviewstate="false" id=Hyperlink1>
Currently, I drag the control from the toolbox, drop it on the page, and then I have to type in the onControlAdded="Bindit" attribute/value. Is there anyway to automate this so that when the control is dropped on to the page at design time, this attribute/value is automatically added for me?
Any advice is appreciated!
Re: how do I add attributes to a server control at design time
Right... figured it out. If anyone is interested, I just added this to my class declaration:
<DefaultProperty("PID"), DefaultEvent("ControlAdded"), ToolboxData("<{0}:HyperLink runat=server onControlAdded=Bindit></{0}:HyperLink>")>