1

i put all my custom "update" code in the RowCommand event, it works fine, but i still get an error from my Data Source

System.NotSupportedException: Updating is not supported by ObjectDataSource 'GetSources' unless the UpdateMethod is specified.

how can i get rid of that error , yes still use my custom update code on the rowcommand?

Madam Zu Zu
  • 6,437
  • 19
  • 83
  • 129
  • I ran into the same issue and the reason I used this methodology instead of declaring the update parameters is because there are thirty of them. I created a business object class that has properties that I populated based on the user's input. The update works fine but I get the same error as you do. – gsirianni Dec 08 '11 at 23:42

1 Answers1

0

Well, I think the way the ObjectDataSource is intended to be used is you specify the name of the method in your custom business object, and it will use reflection to call that method.

So, your page and object might look something like this:

<asp:objectdatasource
              id="ObjectDataSource2"
              runat="server"
              updatemethod="MyUpdateMethod"
              typename="MyBusinessObject">
<updateparameters>
<asp:controlparameter name="anID" controlid="DropDownList1" propertyname="SelectedValue" />
</updateparameters>
</asp:objectdatasource>

Public Class MyBusinessObject

    Public Shared Sub MyUpdateMethod(anID As String)
    'data access code
    End Sub 

End Class

This pattern of putting control together can be quite productive, but you'll probably feel too restricted after a while.

BigMomma
  • 338
  • 2
  • 14