Last post Jun 24, 2010 03:34 AM by Qin Dian Tang - MSFT
Jun 22, 2010 03:27 AM|fsf86|LINK
I have several instances of a custom control, CustomTreeView.ascx which I add dynamically to a Container.ascx custom control, and the Container.ascx instance is added to the page also dynamically.
The code for generating the CustomTreeView instances is set in a if (!isPostback) block, to insure that they are generated only once. However, when an async postback from the CustomTreeView is triggerred, all the instances disappear.
When I remove the generation code from the if (!isPostback) block, the problem disappears. However, the modifaction done to any of the CustomTreeView instances on the page is persistant, the CustomTreeView is not generated back from scratch.
I don't understand why this is happenning, can anyone explain it to me?
Can this be regarded as a problem? or is it a normal behavior?
custom control dynamically generated
Jun 24, 2010 03:34 AM|Qin Dian Tang - MSFT|LINK
Which event you set the CustomTreeView? You can try to set it in Page_Init event without postback checking block.