formview and datasource as collection

M

Mike Gaab

I am trying to use some of the new controls in VS 2005 but
am having some difficulty.

My business logic layer returns Collections of my business objects.
I am used to just assigning these collections to a datagrid's datasource
property. With the new controls I can still do the same but it appears
that the automatic insert,edit, etc. features are not enabled if I do so.

I see that the Formview, and others, have a DataSourceID property
but my Collections don't implement the IDataSource interface nor am
I completely comfortable implementing it.

I hestitate to use the new ObjectDataSource control because it seems
like I lose some flexibility. I am used to manipulating collections.

Any thoughts.
Thanks Mike
 
M

Mike Gaab

Mike Gaab said:
I am trying to use some of the new controls in VS 2005 but
am having some difficulty.

My business logic layer returns Collections of my business objects.
I am used to just assigning these collections to a datagrid's datasource
property. With the new controls I can still do the same but it appears
that the automatic insert,edit, etc. features are not enabled if I do so.

I see that the Formview, and others, have a DataSourceID property
but my Collections don't implement the IDataSource interface nor am
I completely comfortable implementing it.

I hestitate to use the new ObjectDataSource control because it seems
like I lose some flexibility. I am used to manipulating collections.

An example, if I am using a Formview and I set it up with the edit
templates, etc. and then assign my collection of business object to the
Formview's DataSource, I don't get any of the free functionality with
the templated items.

Mike
 
M

Mike Gaab

An example, if I am using a Formview and I set it up with the edit
templates, etc. and then assign my collection of business object to the
Formview's DataSource, I don't get any of the free functionality with
the templated items.

It seems like I should be able to switch modes at runtime.
I've tried doing that using the ChangeMode(...) method but
I must be missing something.

Mike
 
M

Mike Gaab

Mike Gaab said:
It seems like I should be able to switch modes at runtime.
I've tried doing that using the ChangeMode(...) method but
I must be missing something.

I did finally get this to work. The only thing that I don't completely
understand is that I must call DataBind() after ChangeMode(...).
If I don't call DataBind(), nothing happens. Does that make sense
or is that just a hack. I am not used to
programming in .Net so some stuff is a tad foreign. Getting there but
it is taking a while.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top