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
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