Problem with custom LinkButton and AddAttributesToRender

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

  1. Henri

    Henri Guest


    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
    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
    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?

    Henri, Oct 4, 2004
    1. Advertisements

  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 Dechev, Oct 5, 2004
    1. Advertisements

  3. Henri

    Henri Guest

    Thanks Martin

    Henri, Oct 5, 2004
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.