System.Web.UI.WebControls.Adapters

Discussion in 'ASP .Net Web Controls' started by ciaran.mcauliffe@gmail.com, May 10, 2006.

  1. Guest

    Hi all,
    I have been playing with the
    System.Web.UI.WebControls.Adapters.MenuAdapter class, I love how it
    works and as with most things it does 99.9% of what I want it to do.
    The .1% that I want may not be possible, this is where I need some
    help.

    What I want to do is have the adapter ignore some menu controls and
    allow them to render normally, and with some other menu controls render
    them in my special adapter format. I identify the controls which I want
    rendered in a custom way (i.e. with the adapter's custom tags) by
    placing an attribute on the them , and then within the overriden
    functions in the adapter I do something like this:

    protected override void RenderBeginTag(HtmlTextWriter writer)
    {
    if (IsValidForUse)
    {
    writer.WriteLine();
    writer.WriteBeginTag("div");
    writer.WriteAttribute("class", CSSClassName);
    writer.WriteAttribute("id", CSSClassName);
    writer.Write(HtmlTextWriter.TagRightChar);
    writer.Indent++;
    }
    else
    {
    base.RenderBeginTag(writer);
    }
    }

    The IsValidForUse checks to see if the special attribute is present on
    the control and if it is it will render the custom tags. The only
    problem with this is, that when the IsValidForUse property returns
    false and calls base.RenderBeginTag(writer); the menu control does not
    render normally i.e. as if the adapter was not present, which is what I
    want.

    Does anyone know if this is possible?

    Thanks in advance.
    , May 10, 2006
    #1
    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. Matt
    Replies:
    2
    Views:
    819
    Matt Getting
    Jul 24, 2003
  2. byrd48
    Replies:
    0
    Views:
    3,537
    byrd48
    Jul 6, 2006
  3. Dittrich
    Replies:
    0
    Views:
    418
    Dittrich
    Jul 4, 2007
  4. Andy B
    Replies:
    2
    Views:
    3,116
    Andy B
    Apr 23, 2008
  5. Dittrich

    System.Web.UI.WebControls.Adapters.MenuAdapter

    Dittrich, Jul 4, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    122
    Dittrich
    Jul 4, 2007
Loading...

Share This Page