Sharepoint Web Part OnPreRender PostBack Dynamic TextBoxes Not Accessible In Button Handler
- by Matt
I have a custom webpart which extends System.Web.UI.WebControls.WebPart and implements an EditorPart.
I have all the static controls being added in the overridden CreateChildControls method as I know this makes them persistent across PostBacks.
However, I have some TextBoxes being added in the overridden OnPreRender method because the actual TextBoxes that I add depend upon the data returned from a Web Service which I am calling in OnPreRender. The Web Service has to be called in OnPreRender because I need some of the Property values that are set in the EditorPart. If I build this logic into the CreateChildControls method, obviously the data is not available on first PostBack after an edit is applied because the PostBack events are restored after CreateChildControls. This means the page has to be posted twice before the data is refreshed and that is just cludgy.
How can make these TextBoxes along with their entered text values persistent across PostBacks so that I can access them in the button handler?
Thanks for any help,
Matt