Wednesday, March 21, 2012

Event to catch unavailable database with CascadingDropDown

I have the CascadingDropDown control working correctly with 2 DropDownLists. They're both being used with a database and I want to be able to catch any database errors (for example an unavailable db) before the DropDownLists display the dreaded [Method error 500]. From there I can hide the form panel and display a panel with a friendly error message. How would I go about doing that? With an ObjectDataSource I could catch it during the OnSelected event...

I haven't used the CascadingDropDown control but I assume it using the standard ASP.Net Ajax Library for async. calls. So se if the following way of handling exceptions in ASP.Net Ajax will work for you:

http://fredrik.nsquared2.com/viewpost.aspx?PostID=396&showfeedback=true

http://fredrik.nsquared2.com/viewpost.aspx?PostID=395&showfeedback=true

http://fredrik.nsquared2.com/viewpost.aspx?PostID=394&showfeedback=true


Fredrik

This doesn't seem to be working for me... I don't know if the CascadingDropDown behaves differently than the the UpdatePanel or if there's a problem with my configuration. I followed your examples and still receive the error as an item within the dropdown box on the page rather than an alertbox. I also attempted to change the innerHTML of a label using the PageRequestManager to no avail. Otherwise, very good articles that should come in handy with other AJAX controls.

No comments:

Post a Comment