G
Guest
Ok, I've been searching the net now for several days and can't find how to do
this anywhere.
Version:
VS 2005 Professional Release, 2.0 Framework
Background:
I have a complex business object Employee that contains public properties
and several nested objects such as a Spouse object and a List of Coverage
objects.
All data access goes through a DAL
I'm currently able to use an objectdatasource to populate a gridview control
with employee information, displaying the "base" employee information binds
and works like normal, however inorder to display data from one of the nested
objects it gets a little tricky. Currently I am using a template column and
custom databinding expression such as
DirectCast(Container.DataItem, Employee).Spouse.Name
Problem 1:
This works for displaying the data but does not facilate updating. The
binding is only 1 way, i can't figure out how to use the 2 way Bind("asdlfj")
expression to work with a complex object.
Problem 2:
When the objectdatasource then calls the update Function it passes an
Employee object as the parameter. The passed in employee object's base
properties are fine, however all the nested object properties are set to
Nothing, I was able to fix this by changing the class declacration from
Public Class Spouse to
<Serializable()> Public Class Spouse
I am not real familiar with Serialization and what other effects this has on
my class though. An explanation of what this is doing and if it is the
correct way of doing this would be appreciated.
Letting off steam:
I can't believe that Microsoft would promote the objdatasource as much as it
seems they are if it can't easily handle complex object structures. If the
application is complex enough to justify a 3+ tier design then chances are
the objects are gonna be complex. . . . . If 2 way data binding isnt'
possible with complex objects then the objectdatasource is a complete waste.
Hopefully i'm wrong and this all works, in which case it will be VERY nice.
Thanks for your help in advance.
this anywhere.
Version:
VS 2005 Professional Release, 2.0 Framework
Background:
I have a complex business object Employee that contains public properties
and several nested objects such as a Spouse object and a List of Coverage
objects.
All data access goes through a DAL
I'm currently able to use an objectdatasource to populate a gridview control
with employee information, displaying the "base" employee information binds
and works like normal, however inorder to display data from one of the nested
objects it gets a little tricky. Currently I am using a template column and
custom databinding expression such as
DirectCast(Container.DataItem, Employee).Spouse.Name
Problem 1:
This works for displaying the data but does not facilate updating. The
binding is only 1 way, i can't figure out how to use the 2 way Bind("asdlfj")
expression to work with a complex object.
Problem 2:
When the objectdatasource then calls the update Function it passes an
Employee object as the parameter. The passed in employee object's base
properties are fine, however all the nested object properties are set to
Nothing, I was able to fix this by changing the class declacration from
Public Class Spouse to
<Serializable()> Public Class Spouse
I am not real familiar with Serialization and what other effects this has on
my class though. An explanation of what this is doing and if it is the
correct way of doing this would be appreciated.
Letting off steam:
I can't believe that Microsoft would promote the objdatasource as much as it
seems they are if it can't easily handle complex object structures. If the
application is complex enough to justify a 3+ tier design then chances are
the objects are gonna be complex. . . . . If 2 way data binding isnt'
possible with complex objects then the objectdatasource is a complete waste.
Hopefully i'm wrong and this all works, in which case it will be VERY nice.
Thanks for your help in advance.