Using the OBJECTDATASOURCE and a bound datagrid

A

AAJ

Hi

Is there anyone out there who can help? I am experiencing 2 problems which
relate to Datagrids

1) If I have a class that holds an arraylist of objects, I can return the
ArrayList via Icollection and bind using OBJECTDATASSOURCE and GRID to it
i.e.

public TempCollection ();
{
}
public Icollection ReturnList()
{
return myArrayList; // (full of Labour objects)
}

works fine, I can use VS2005 to drop a datagrid on the screen and bind to
it, all works well.

In real life I have a large class that encapusulates lots of data, one
element being an array list of Labour classes. The class takes a constructor
that is a PK of a record in a database. What I want to do is the same as
above, but as soon as my class uses a constructor, the binding fails at run
time ie this doesn't work this can be illustrated below

public TempCollection (int PKRecord);
{
...... and other methods etc....
}
public Icollection ReturnList()
{
return myArrayList;
}

This comes up with an error when the datagrid is executed.

2) When using the wizard for binding ObjectDataSources, it looks at the
class and not the object. The list that I am presented with is the classes
in the project, and not the objects that I will be instantiating.

An example may be a class called AllLabour, of which there are 3 instances
of AllLabour i.e. AllLabour1,AllLabour2,AllLabour 3. I can select AllLabour
from the dropdown, but not the actual object its self and hence I can't bind
to the actual data I require.


many thanks to anyone who can help with either of the two problems

Andy
 
A

AAJ

After reading the Help (should have read it first perhaps), it seems it is
behaving correctly, I will have to modify my code to suit.

Does anyone have any good examples of Patterns that use this middle tear
architecture with ObjectDataSource?

thanks again

Andy
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top