Tutorial :Which User Control event comes between data binding (other controls) and Render?



Question:

I'm currently building a user control that displays a message when a Repeater is empty.

The idea is simple, provide the user control with the ID of the Repeater. When the user control is rendered look up the Repeater and check Items.Count. If it's zero then display the message.

I would like to add one more feature though. I want to be able to hide the Repeater if there are no Items.

Obviously I can't do this in protected override void Render(HtmlTextWriter writer) because the Repeater has (possibly) already been rendered. I also can't do this when the the Repeater ID is assigned to the user control, as the databinding hasn't happened yet.

So my question is.. what event can I override in my user control where databinding has occurred, but rendering has not.


Solution:1

Consider the Page's PreRender event. That way binding has happened but nothing has yet been rendered although they are just about to.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »