0

I know what the error means - I know how to fix it...but I cannot find where it is happening in my code. I suspect it is occurring in dropdownlists that use sqldatasource. I am using VS 2008 C#.net with FormView. When I click FV Update button the _ItemUpdating event runs...I have debugged every line of code in that routine and no errors are thrown. I even have a try/catch to find FormatException and SqlException errors and they are not caught. When the page refreshes (after update completes) "Input string error..." pops up with no indication of where in the code or what objects are having the problem. Before I post my code and because I think this is a debugger problem I wanted to ask the question (which I have not found by googling..) :

Is there a VS debugger configuration setting that might solve this problem?

UPDATE: I posted an answer. The problem was that debugger doesn't (at least in my VS 2008 configuration) debug controls on the .aspx page, only the .aspx.cs pages. I literally had to guess where the error was coming from and it took days.

Doreen
  • 714
  • 2
  • 14
  • 36
  • Possible duplicate of [Visual Studio: How to break on handled exceptions?](http://stackoverflow.com/questions/116896/visual-studio-how-to-break-on-handled-exceptions) – Matthew Whited Sep 08 '16 at 23:53
  • I read the link you provided and ticked the "thrown" checkbox for System.FormatException and it had no effect when clearly the exception states it is a FormatException. I am at a loss for why I can't pinpoint where the exception is happening. – Doreen Sep 09 '16 at 16:59

1 Answers1

0

The problem was with a couple of textbox controls on the aspx page that were bound to sqldatasource. Apparently my debugger doesn't debug sqldatasource. I had incorrectly formatted the SQL decimal data types as currency like this:

`Text='<%# Bind("RegistrationCost", "{0:C}") %>'

After removing the currency formatting like so: Text='<%# Bind("AirfareCost" ) %>' the Update button started working again!

I noticed my error as I re-wrote the code to fill formview using DataTable and update sql database directly without using sqldatasource.

Doreen
  • 714
  • 2
  • 14
  • 36