Results 1 to 2 of 2

Thread: how do I add attributes to a server control at design time

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    10

    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!

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    10

    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>")>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width