Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Controls / September 2007

Tip: Looking for answers? Try searching our database.

How to handle exceptions that occur in ObjectDataSource.Select ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Thomas - 26 Sep 2007 10:49 GMT
Hi,

I have a dataview and ObjectDataSource controls in an .aspx page. The
ObjectDataSource has a SelectMethod with selectParameters collection. The
DataView is bound to the objectdatasource with its property DataSourceID
inside the aspx page (not dynamically in the code). I would like to handle
properly an exception that occurs in SelectMethod of ObjectDataSource
control. I put a try/catch block in the SelectMethod (the exception is just
thrown with "throw;" instruction) but I don't figure how to catch it in
.aspx page where the dataview and the objectdatasource controls are
declared. The selectMethod run once the dataview is bound to the
objectdatasource but if an exception occurs the error page is displayed.
Thanks in advance for your help.

Regards,

Thomas
Phil H - 26 Sep 2007 21:05 GMT
> Hi,
>
[quoted text clipped - 13 lines]
>
> Thomas

Hi Thomas

If you bind the object data to the visual control with the
DatasourceID property then the error handling is outside your control
for the standard events. You need to handle it within the Select
method in your code rather than pass it up the chain with "Throw".
Thomas - 27 Sep 2007 08:27 GMT
Thanks for your reply. I finally handled exceptions in Application_Error in
global.asax. It was the easiest way for me to do it without modifying the
code.

Regards,

Thomas

>> Hi,
>>
[quoted text clipped - 22 lines]
> for the standard events. You need to handle it within the Select
> method in your code rather than pass it up the chain with "Throw".

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.