Callback exception/error handling for ASP TreeView OnTreeNodePopulate?

Posted by MHutchinson on Stack Overflow See other posts from Stack Overflow or by MHutchinson
Published on 2010-05-13T12:57:42Z Indexed on 2010/05/13 13:14 UTC
Read the original article Hit count: 145

Filed under:
|
|

We're using an asp:TreeView configured with lazy loading. The callback method assigned for OnTreeNodePopulate throws an exception if the user has been logged out since the page was loaded. What we want to do is to direct the user to the login page.

First attempt was to catch the exception on the server and try Response.Redirect(...), but that doesn't work because you can't redirect within a callback.

I've tried various other approaches, including using ClientScript.RegisterStartupScript(...) but that doesn't seem to work for OnTreeNodePopulate.

If there was some way we could hook into the callback event handling on the client side then it would be easy, but the TreeView doesn't seem to offer anything here.

Suggestions?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about treeview