I am writing a single ASP Form that dynamically changes Div boxes that are visible from mouse clicks on buttons and when text in textboxes is changed in an Ajax container. The problem i have is in the Page_Load function i create all the objects (text boxes, radio buttons, buttons, etc) dynamically from a .csv file template sitting on the asp hosting server. Everytime a postback happens, even within the Ajax window, the Page_Load function is called again and the .csv file is re-read, and all objects are re-created.
I have tried Checking for IsPostback before re-creating any objects but the objects are then nullified as they have never been created. The page is as a completely new page every single time.
Any ideas would be greatly appreciated.
Try using the Page_PreInit event rather than Page_Load to re-create/manipulate your dynamic controls:
More info: http://msdn.microsoft.com/en-us/library/ms178472.aspx