Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...try catch exceptions with object data sourcetry catch exceptions with object data source
Previous
 
Next
New Post
4/29/2011 12:05 PM
 
I have a form with an object data source that pulls data from a service reference. Here's the form and the routine from my .cs. It works fine when I enter a valid part number. When a part number is not found by the service reference, it throws back an exception. I'd like to handle this exception, but my try..catch block is not working, it's still throwing "A critical error has occurred. Exception has been thrown by the target of an invocation" and my page stops working. What is the proper way to handle the exception error?

<%@ Control Language="C#" Inherits="MyStockLookup.MyStockLookup" CodeFile="~/DesktopModules/StockLookup/StockLookup.ascx.cs" %>



SelectMethod="GetItemByID"
TypeName="StatusLookupRef.ItemServiceClient"
onselected="ObjectDataSource1_Selected">


BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3"
CellSpacing="2" DataSourceID="ObjectDataSource1" EnableModelValidation="True"
GridLines="Both">


Item ID:



Item Description:



Quantity On Hand:
Text='<%# Bind("qty_on_hand") %>' />


Quantity Available:
Text='<%# Bind("qty_available") %>' />











protected void StockLookup(string sNoData)
{
try
{
ObjectDataSource1.DataBind();
}
catch (ModuleLoadException ex)

{
Exceptions.ProcessModuleLoadException(this, ex);

}

catch (PageLoadException ex)
{
Exceptions.ProcessPageLoadException(ex);

}


}
 
New Post
2/13/2013 5:59 AM
 
Hi all

I am also facing the same problem. I am trying to handle the exception generated from service reference when wrong inputs provided. But the try... catch block is not handling this which results in module crash.

Does dnn override any exceptions which may restrict the proper execution of the catch block???
Any idea???

Thanks,
Sunil Kumar [ DNN Developer, Mindfire Solutions,India ]
 
New Post
2/15/2013 3:48 AM
 
Solved my issue. This may useful if any one else would ever faced the probelm.

Try using the try...catch inside Reference.cs that created at time of creating service reference.

But the question remain unsolved...

Does dnn override any exceptions which may restrict the proper execution of the catch block??

As in my case exception generated from the service reference is not handled with the try...catch in modules ViewXXXX.ascx.cs page

Thanks,
Sunil Kumar [ DNN Developer, Mindfire Solutions,India ]
 
Previous
 
Next
HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...try catch exceptions with object data sourcetry catch exceptions with object data source


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out