locked
bypass objectdatasource DeleteMethod RRS feed

  • Question

  • User-2132746437 posted

    Is there a way to bypass the DeleteMethod within the objectdatasource? I have a delete method that I call to delete a record and it works, however, if I remove the DeleteMethod from the objectdatasource it errors out, is there a work around for this? I don't want to use the objectdatasource delete method, I need to use my delete method

    Thursday, October 4, 2018 3:38 PM

Answers

  • User-2132746437 posted

    I got it working, I had to create a new Delete method in the OPS.CARS class

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 4, 2018 4:23 PM

All replies

  • User753101303 posted

    Hi,

    It is needed even you don't have a Delete button ? Not sure how yours is called. It seems a bit awkward to have something special here (or just calling your method from the "DeleteMethod" is not possible ?).

    At worst have you tried to keep a DeleteMethod that does nothing ? IMO  you likely have a better solution. Maybe should you explain why you need to not really use the usual approach when using an ObjectDataSource here ?

    Not directly related but since 4.5 you have also https://docs.microsoft.com/en-us/aspnet/web-forms/overview/presenting-and-managing-data/model-binding/retrieving-data which basically skip the ObjectDataSource and write directly data handling code.

    Thursday, October 4, 2018 3:54 PM
  • User-2132746437 posted

    It's an 3.5 project not 4.0

    It keeps kicking out an error of:

    ObjectDataSource 'GridViewDataSource' could not find a non-generic method 'Delete' that takes parameters of type 'AutoDealers.NE.OPS.Cars'

    Thursday, October 4, 2018 4:02 PM
  • User-2132746437 posted

    I got it working, I had to create a new Delete method in the OPS.CARS class

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 4, 2018 4:23 PM