Urgent: Custom Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James T.

    Urgent: Custom Control

    Hello!

    I am developing a custom server control that inherits from Hyperlink web
    control.

    I defined 2 new properties - ImageWidth and ImageHeight. My qustion is, how
    I can override Render method so if Hyperling ImageUrl is set then add
    ImageWitdh and ImageHeight attributes to image.

    Thank you!
    James


  • Scott Allen

    #2
    Re: Urgent: Custom Control

    Hi James:

    My suggestion would be to add the attributes to the Attributes
    collection of the control - the inherited functionality will take care
    of rendering the attributes you specify in this collection.

    --
    Scott



    On Tue, 3 May 2005 16:00:13 +0300, "James T." <gimenei@hotmai l.com>
    wrote:
    [color=blue]
    >Hello!
    >
    >I am developing a custom server control that inherits from Hyperlink web
    >control.
    >
    >I defined 2 new properties - ImageWidth and ImageHeight. My qustion is, how
    >I can override Render method so if Hyperling ImageUrl is set then add
    >ImageWitdh and ImageHeight attributes to image.
    >
    >Thank you!
    >James
    >[/color]

    Comment

    • James T.

      #3
      Re: Urgent: Custom Control

      Could you please provide me an example?

      James
      [color=blue]
      > Hi James:
      >
      > My suggestion would be to add the attributes to the Attributes
      > collection of the control - the inherited functionality will take care
      > of rendering the attributes you specify in this collection.
      >
      > --
      > Scott
      > http://www.OdeToCode.com/blogs/scott/
      >
      >
      > On Tue, 3 May 2005 16:00:13 +0300, "James T." <gimenei@hotmai l.com>
      > wrote:
      >[color=green]
      >>Hello!
      >>
      >>I am developing a custom server control that inherits from Hyperlink web
      >>control.
      >>
      >>I defined 2 new properties - ImageWidth and ImageHeight. My qustion is,
      >>how
      >>I can override Render method so if Hyperling ImageUrl is set then add
      >>ImageWitdh and ImageHeight attributes to image.
      >>
      >>Thank you!
      >>James
      >>[/color]
      >[/color]


      Comment

      • Scott Allen

        #4
        Re: Urgent: Custom Control

        Hi James:

        You might want to take a look at Reflector [1] and see the source code
        to for rendering the HyperLink (it's in RenderContents) . The code is
        pretty straightforward , and you could actually override the method and
        duplicate the code to add a couple lines and set the Image control
        properties.

        Do you know how to override a method? What language are you using?

        [1] http://www.aisto.com/roeder/dotnet/

        --
        Scott


        On Tue, 3 May 2005 16:12:25 +0300, "James T." <gimenei@hotmai l.com>
        wrote:
        [color=blue]
        >Could you please provide me an example?
        >
        >James
        >[color=green]
        >> Hi James:
        >>
        >> My suggestion would be to add the attributes to the Attributes
        >> collection of the control - the inherited functionality will take care
        >> of rendering the attributes you specify in this collection.
        >>
        >> --
        >> Scott
        >> http://www.OdeToCode.com/blogs/scott/
        >>
        >>
        >> On Tue, 3 May 2005 16:00:13 +0300, "James T." <gimenei@hotmai l.com>
        >> wrote:
        >>[color=darkred]
        >>>Hello!
        >>>
        >>>I am developing a custom server control that inherits from Hyperlink web
        >>>control.
        >>>
        >>>I defined 2 new properties - ImageWidth and ImageHeight. My qustion is,
        >>>how
        >>>I can override Render method so if Hyperling ImageUrl is set then add
        >>>ImageWitdh and ImageHeight attributes to image.
        >>>
        >>>Thank you!
        >>>James
        >>>[/color]
        >>[/color]
        >[/color]

        Comment

        Working...