Home - Forums-.NET - FlyTreeView (ASP.NET) - NodeCheckedChanged before Page_Load

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

NodeCheckedChanged before Page_Load
Link Posted: 08-Sep-2009 11:07
Hi,
Is there any reason that NodeCheckedChanged runs before Page_Load? Is there any way how to run the NodeCheckedChanged event after Page_Load, in common way?
Thank you.
Pribram
Link Posted: 08-Sep-2009 19:27
Yes, all NodeXXXX events are fired at load-post-data stage.
These events are fired one by one to apply all client-side changes (events) occurred since last postback.

So if you need to see what nodes are checked, then use GetCheckedNodes(), or for other conditions FindAll(..), Find(..) methods of FlyTreeView.
Link Posted: 08-Sep-2009 20:55
Well, in Page_Load I usually set web.config things, DB connections, reading sessions etc. In case I need these "global" settings inside a NodeXXXX method, the Page_Load method must be fired twice:

protected string _param;

protected void Page_Load(object sender, EventArgs e)
{
   _param = "aaa";
}

protected void MyFlyTV_NodeCheckedChanged(object sender, FlyTreeNodePropertyChangedEventArgs e)
{
   Page_Load(null, null); //to set _param
   SomeFnc(_param);
}

So I think it would be nice to add some switch to FTV, e.g. "FireNodeEventsOrder"....
Thanks,
Pribram
Link Posted: 08-Sep-2009 22:44
Looks like you need to use Page_Init method instead to setup connections, etc.
It fires before anything else.

Node-level events cannot be fired after Page_Load, these events do apply client-side changes (load postback data) to FlyTreeView instance. This is what load-post-data page lifecycle stage for.