views:

32

answers:

1

I've created several DNN (5.2.3) modules and I'm finding that if an error happens on the object data source (ODS) DNN will then show that error to everyone. A sample (though not a ODS specific error in this case) is shown below. This has no meaning to user. The exception should really be "Thing not found" or something like that to the user. The problem is that this DropDownList is bound to an ODS. So my questions are:

  1. How in DNN can I override this behavior to show a helpful message using ODS binding?
  2. How in DNN can I override this behavior to show a generalized exception for all errors for the current module, if a specific exception cannot be caught to give a helpful message to the user?

Sample: 'SelectedThingDropDown' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value

PS> I know about try/catch Exceptions.ProcessModuleException(e,ex). The problem is this does not work for ODS binding, unless I'm doing something wrong.

A: 

Hi thames, There are number of places you can inspect while dealing with ODS and DropDownList. Here is list of some of them.

  1. ODS_Selected event, check e.Exception: This object is having errors when calling Select method provided. It's null if there is no error. If you find error, you can disable the ddl and place a user friendly message in label for notification.
  2. DDL_DataBound event: Don't directly bind the selected value, try to find the the dll items by value like :
ListItem item = ddl.Items.FindByValue('');
if(item != null) item.selected = true;

Keep in mind that module load exception will be there only if you are not handling the exceptions, if you feel they are not helpfull to user, you can override them by your own user notification method with the help of try catch as you said. but don't forget to create entries in the event log for the error so that you can track your errors and optimize them.

Good luck.

lakhlaniprashant.blogspot.com
the DDL is loaded from an ODS. The selected value is not in the DDL and throws the exception. There is no codebehind all is done in ODS.
thames