locked
DeleteT_ and ValidationException RRS feed

  • Question

  • User1414551024 posted

    When ValidationException is thrown in InsertT_ partial method it's nicely handled and displayed as user-friendly red error message. That's nice.

    I tried to throw same exception in DeleteT_ (to handle DELETE failed because of FOREIGN KEY constraint) hoping to have it also nicely displayed on screen but it shows as unhandled javascript exception. Is there a trick I can use to have it also handled similarly?

    Thursday, August 21, 2008 5:08 AM

Answers

  • User1641955678 posted

    I think I understand the cause: the Delete link has CausesValidation="false".  If you set that to true instead, it should work.  Could you please give it a try and let use know?

    thanks,
    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 29, 2008 9:07 PM

All replies

  • User1641955678 posted

    Hmmm, not sure why that wouldn't work.  Is this with Linq To Sql or Entity Framework?  I assume you're using the final 3.5 SP1 bits?

    David

    Friday, August 22, 2008 9:09 PM
  • User1096106646 posted

    We're using linq to sql, final 3.5SP1. Before that we used SP1 beta (If I remember correctly when installing final sp1, we didn't do uninstall of the beta).

    I also noticed someone else reported exact same issue some time ago, without resolution on the forum.

    Sunday, August 24, 2008 5:28 PM
  • User660823006 posted

    This reproduced for me with Linq2Sql and we will look into it and see if we can come up with a workaround for you.

    Sunday, August 24, 2008 6:58 PM
  • User1641955678 posted

    I think I understand the cause: the Delete link has CausesValidation="false".  If you set that to true instead, it should work.  Could you please give it a try and let use know?

    thanks,
    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 29, 2008 9:07 PM
  • User2014418618 posted

     Works a charm, of course. When you see the solution it becomes obvious, but prior to that .... ;)

    Tuesday, September 2, 2008 3:51 AM