PreRender not being called, solution

T

Todd Bandrowsky

If PreRender is not being called on a control, it means the control's
Visible property is false. This can lead to an interesting situation.
If you set your control's visible property in its own PreRender, it
can effectively black itself out permanently. I tripped on this while
trying to have a child control tell the parent to hide.

I was doing goofy stuff by setting visible in page_load and
page_render and it turned out the cleanest way was to add an event to
the child and subscribe the parent to it, so whenever I set the
visible on the child, the parent can see the change and then respond.

I also had to override the child's visible property as it could not
properly queried during the event.

public event EventHandler VisibleChanged;

bool _super_visible;

public override bool Visible
{
get { return _super_visible; }
set { _super_visible = base.Visible = value;}
}
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top