Problem with custom LinkButton and AddAttributesToRender

Discussion in 'ASP .Net' started by Henri, Oct 4, 2004.

  1. Henri

    Henri Guest

    Hi,

    I'm trying to design a custom LinkButton.
    It inherits LinkButton as I need the implementation of the Click event (and
    I don't know how to rewrite it).
    I have to use AddAttributesToRender to render all the style attributes and
    properties.
    But as I want to specifie my own href attribute, I can't use LinkButton's
    default AddAttributesToRender as it automatically adds its own href
    attribute.
    It would be great if I could call only WebControl's AddAttributesToRender
    (LinkButton's parent class) but it doesn't seem possible to call it from my
    class as it inherits LinkButton.
    So do I need to rewrite completely WebControl's AddAttributesToRender
    implementation to get rid of the href attribute added by LinkButton?
    Do you have any solution?
    Thanks

    Henri
     
    Henri, Oct 4, 2004
    #1
    1. Advertising

  2. Hi, Henri,

    Most probably it will be possible to achieve what you need to do using
    Attributes.Add("onclick", "...") on the instance instead of altering the
    href attribute.

    Hope this helps
    Martin
    "Henri" <> wrote in message
    news:...
    > Hi,
    >
    > I'm trying to design a custom LinkButton.
    > It inherits LinkButton as I need the implementation of the Click event

    (and
    > I don't know how to rewrite it).
    > I have to use AddAttributesToRender to render all the style attributes and
    > properties.
    > But as I want to specifie my own href attribute, I can't use LinkButton's
    > default AddAttributesToRender as it automatically adds its own href
    > attribute.
    > It would be great if I could call only WebControl's AddAttributesToRender
    > (LinkButton's parent class) but it doesn't seem possible to call it from

    my
    > class as it inherits LinkButton.
    > So do I need to rewrite completely WebControl's AddAttributesToRender
    > implementation to get rid of the href attribute added by LinkButton?
    > Do you have any solution?
    > Thanks
    >
    > Henri
    >
    >
    >
     
    Martin Dechev, Oct 5, 2004
    #2
    1. Advertising

  3. Henri

    Henri Guest

    Thanks Martin

    "Martin Dechev" <> a écrit dans le message de
    news:...
    > Hi, Henri,
    >
    > Most probably it will be possible to achieve what you need to do using
    > Attributes.Add("onclick", "...") on the instance instead of altering the
    > href attribute.
    >
    > Hope this helps
    > Martin
    > "Henri" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I'm trying to design a custom LinkButton.
    > > It inherits LinkButton as I need the implementation of the Click event

    > (and
    > > I don't know how to rewrite it).
    > > I have to use AddAttributesToRender to render all the style attributes

    and
    > > properties.
    > > But as I want to specifie my own href attribute, I can't use

    LinkButton's
    > > default AddAttributesToRender as it automatically adds its own href
    > > attribute.
    > > It would be great if I could call only WebControl's

    AddAttributesToRender
    > > (LinkButton's parent class) but it doesn't seem possible to call it from

    > my
    > > class as it inherits LinkButton.
    > > So do I need to rewrite completely WebControl's AddAttributesToRender
    > > implementation to get rid of the href attribute added by LinkButton?
    > > Do you have any solution?
    > > Thanks
    > >
    > > Henri
    > >
    > >
    > >

    >
    >
    >
     
    Henri, Oct 5, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sathyaish
    Replies:
    3
    Views:
    3,113
    Sathyaish
    Sep 8, 2005
  2. Henri

    Problem with LinkButton and AddAttributesToRender

    Henri, Oct 3, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    135
    Henri
    Oct 3, 2004
  3. Paul L

    Custom CheckBox class not calling AddAttributesToRender

    Paul L, Mar 17, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    134
    Paul L
    Mar 17, 2005
  4. TS

    checkboxlist "AddAttributesToRender"

    TS, Feb 16, 2009, in forum: ASP .Net Building Controls
    Replies:
    6
    Views:
    1,333
  5. Sathyaish

    Linkbutton does not look like a linkbutton

    Sathyaish, Sep 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    189
    Sathyaish
    Sep 8, 2005
Loading...

Share This Page