Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   System.Web.UI.WebControls.Adapters (http://www.velocityreviews.com/forums/t778118-system-web-ui-webcontrols-adapters.html)

ciaran.mcauliffe@gmail.com 05-10-2006 04:23 AM

System.Web.UI.WebControls.Adapters
 
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.



All times are GMT. The time now is 02:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.