.my treeview is inside a updatepannel.
Ok. But is the 'ok' button inside update panel? Or if 'ok' button is outside the update panel, is it set as an Async trigger for the update panel to partial refresh?
I guess, doing either will resolve your issue.
If needed, related links:
UpdatePanel Control Overview[
^]
MSDN: AsyncPostBackTrigger Class[
^]