views:

32

answers:

3

Hello,

For example what if I am trying to hide a custom navigation control what can I place in another webcontrol to conditionally hide the label something like this

   <mycontrol:hidethis id=mycontrol1 runat="server">
          <mycontrol:mynavi runat="server"/>
    </mycontrol:hidethis>

Thanks

A: 

Why don't you add a property to the control which says Visible and you internally set the control as visible true/ false.

Ravia
A: 

Have a look at

protected override void AddParsedSubObject(object obj)
{

}

That should be the right place to say wether subcontrols should be rendered or not

citronas
A: 

Your question is wide open, there could be a few ways to hide your control.

One very simple way to do it is in the PreRender of the navigation control's parent - just set the Visible property of the nav control to false (if the right conditions are met). If coded correctly (i have to say that, sometimes people code stupidly :) then the Visible property will be propagated to all the child controls of the nav control, and none of them will get rendered to the output stream.

slugster