OnClick Handler for Buttons added During Page_PreRender? How?

S

Sky Sigal

Hello:
I am designing a WebControl that swaps between a DayView, WeekView, or Month Schedule.
What I have done this time is to use CreateChildControls() to make a Pulldown that offers the view
type
but leave rendering of the actual calendar to PreRender(), where it reads the value of the DropDown
to decide what type of Table/TableRow/TableCells algorythm
to use (DayView = one column x many rows, WeekView, two columns, 4rows, etc...)

Wiring up an EventHandler for the Select/Dropdown was easy since it existed and was added to the
control hierarchy before Page_Load finished.

But I can't figure out how to catch clicks on the Cells, since they are generated after Page_Load,
and any buttons that I put in them, and attach EventHandlers to, are never called...

I can't make them before, because there are so many cells -- I don't think I should add a week view,
day view, month view to the control just to wire up an events to them, and then discard the layouts
I am not using. Would be insane and super slow/heavy.

I think that the idea would be IPostBackDataHandler -- but I am not sure how to wire it up.

If anybody has some experience with this -- man, that would really make my day. It seems that most
of the controls I want to do are being held up by this concept: making it so that rendering can
change shape -- yet be able to catch events from TextBox and buttons within the output.

Thanks so much!
Sky
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top