This is a migrated thread and some comments may be shown as answers.

[Solved] ObjectDataSource Update expects individual parameters not class

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 06 Mar 2013, 12:27 PM
I'm trying to use an ObjectDataSource bound to a RadGrid to perform automatic Select, Insert, Update and Delete.  The OnSelecting method of the ODS refers to a method that is a member of MyClass, and returns a List<MyClass>.  The OnUpdating method is also a member of that class and is annotated with [DataObjectMethod(DataObjectMethodType.Update, true)]

        [DataObjectMethod(DataObjectMethodType.Update, true)]
        public void updateMyClass(MyClass myClassToUpdate, string UserId)
        {
            BusinessLayer.updateClass(myClassToUpdate, UserId);
        }

The exception I'm getting indicates that the method should list the individual fields of the class. That's not how I'm used to doing this and some of my classes I'll be using have a large number of fields.  Is there a setting for RadGrid or something else I'm missing that would allow me to pass the class in directly?

Steve

1 Answer, 1 is accepted

Sort by
0
Steven
Top achievements
Rank 1
answered on 07 Mar 2013, 02:28 AM
Found it.  In the ObjectDataSource make sure that the DataObjectTypeName property is set and it will pass a class.
Tags
Grid
Asked by
Steven
Top achievements
Rank 1
Answers by
Steven
Top achievements
Rank 1
Share this question
or