I am trying to expand my server control knowledge and am re-developing some forums that I have written so that they operate as a single server control.
I am having a problem with the order that events are triggered. Pretty well all the functionality of the control is in the CreateChildControls method where I am merging html via literals with button server controls. I do have a few other functions, but they are all called from the CreateChildControls method. I am maintaining the state of the control (list messages, reply to message, etc) via variables held in ViewState that are changed when the buttons are clicked. The problem is that I am having to press the buttons twice to get them to work properly. I suspect that this may have something to do with the either the order the code is processed or the way that it is stored in ViewState. Someone has suggested putting some code in the OnPreRender method, but I really don't know where to start since I am rendering some html via a literal control, adding some buttons, rendering more html, etc - the order is quite specific to ensure that the generated html is in a specific order. I have been battling with this for a while now and would really appreciate some help. I would be happy to post the code if this would help. Thanks in advance. -- Cheers, Julian Voelcker The Virtual World (UK) Limited Cirencester, United Kingdom