Hello.
I use RadGrid and ObjectDataSource (ods) to fill the grid with data.
I used to make insert, update and delete from code behind (using RadGrid events: UpdateCommand, DeleteCommand , etc) - so, i used to create my objects using FindControl(string id) and then manipulate with them.
Now, I decide to do this using ods, but i cannot work it out while i have nested objects.
(in case of single object it works fine - i mean if i Insert, Update or Delete only Person class - see below)
Here is my example:
class User{ class Person{
int ID int ID;
int PersonID; string FirstName;
string UserName; string LastName;
} }
My ods methods are:
SelectMethod: iList<
User
> GetUsers();
InsertMethod, UpdateMethod: void SaveUser(User u);
DeleteMethod: void DeleteUser(User u);
In my EditFormTemplate i bind these like this (binding works fine):
<
telerik:RadTextBox
ID
=
"txtUserName"
runat
=
"server"
Text='<%# Bind("UserName") %>'/>
<
telerik:RadTextBox
ID
=
"txtFirstName"
runat
=
"server"
Text= '<%# DataBinder.Eval(Container.DataItem, "Person.FirstName") %>' />
<
telerik:RadTextBox
ID
=
"txtLastName"
runat
=
"server"
Text= '<%# DataBinder.Eval(Container.DataItem, "Person.LastName") %>' />
So, when i am trying to update user object, updates only UserName, update does not cause to FirstName and LastName (User.Person properties). I guess ods cannot recognize them at all...
Is there any solution for this?
Or is there any alternative way to act situations lake this?
P.S. the same problem is when i use LinqDataSource
thanks.