473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using the OBJECTDATASOURCE and a bound datagrid

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
Aug 22 '06 #1
1 1106
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

"AAJ" <a.a.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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

Aug 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kjetil Klaussen | last post by:
Hi, I’m having some troubles trying to bind my dataset to a GridView control through an ObjectDataSource control. The binding works fine for regular columns in my dataset, but I can’t seem...
1
by: Scott F K Hooper | last post by:
My ASP.NET 2.0 project has a GridView that I want to be able to edit and update records with. The GridView has been bound to an ObjectDataSource control that has the following Update method...
0
by: John Davis | last post by:
Hi all, hope you are well. I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource object. I am currently creating some...
0
by: John Davis | last post by:
Hi all, hope you are well.(not sure if this posted the first time) I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
1
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I really hope this is not a case of "this silly thing will never work".....lots of time invested in troubleshooting this already. I have created a standard ASP.NET web form (.aspx) with several...
0
by: HockeyFan | last post by:
I've got Gentle.Net objects bound to an ObjectDataSource. I have a grid that comes up fine. I then have a DetailView that is bound to another ObjectDataSource. When I try to update from the...
0
by: Chris Zopers | last post by:
Hello, I have some textboxes in a FormView control. The FormView is bound to an ObjectDataSource. The ObjectDataSource has a SelectMethod that gets an object and the textboxes in the FormView...
0
by: Chris Zopers | last post by:
Hello, I have some textboxes in a FormView control. The FormView is bound to an ObjectDataSource. The ObjectDataSource has a SelectMethod that gets an object and the textboxes in the FormView...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.