Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > System.Web.UI.WebControls.Adapters

Reply
Thread Tools

System.Web.UI.WebControls.Adapters

 
 
ciaran.mcauliffe@gmail.com
Guest
Posts: n/a
 
      05-10-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57