473,511 Members | 9,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView ObjectDataSource

Is it possible to do the following:-

Create an ObjectDataSource object that has an embedded ArrayList of Objects.
Allow the ASP.NET application to create and populate an instance of the
ObjectDataSource...and pass this to a GridView control... I don't want the
GridView control to create its own instance of the ObjectDataSource object.??
this could be where the problem is...

For example I have

a class called ItemLine with properties int _ItemLn, DateTime _ItemDate,
string _Desc, double _Amount...with the usual get/setters
....int ItemLn() { get{ return _ItemLn;} set{ _ItemLn=value;} etc

I then populate an array with ItemLine objects for example

1,12/12/2006,"hello1",3.99
2,13/11/2006,"helo2",2.99
etc
This ArryaLIst of ItemLine is then enclosed in a ItemLineDataSource class
with methods for returning all the items, updating, inserting and deleting
items...

This ItemLineDataSource instance should then be used with the GridView
control!!!

is this possible?
Nov 26 '06 #1
1 2285
Okay I now realise that the ObjectDataSource used with a GridView must be
stateless, have a default zero parameter constructor etc.... so it can't work
on a particular users set of data ie in an arraylist...

"pblack9455" wrote:
Is it possible to do the following:-

Create an ObjectDataSource object that has an embedded ArrayList of Objects.
Allow the ASP.NET application to create and populate an instance of the
ObjectDataSource...and pass this to a GridView control... I don't want the
GridView control to create its own instance of the ObjectDataSource object.??
this could be where the problem is...

For example I have

a class called ItemLine with properties int _ItemLn, DateTime _ItemDate,
string _Desc, double _Amount...with the usual get/setters
...int ItemLn() { get{ return _ItemLn;} set{ _ItemLn=value;} etc

I then populate an array with ItemLine objects for example

1,12/12/2006,"hello1",3.99
2,13/11/2006,"helo2",2.99
etc
This ArryaLIst of ItemLine is then enclosed in a ItemLineDataSource class
with methods for returning all the items, updating, inserting and deleting
items...

This ItemLineDataSource instance should then be used with the GridView
control!!!

is this possible?

Nov 28 '06 #2

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

Similar topics

0
1480
by: Eiriken | last post by:
Hello everyone, I am using ASP.NET 2 and trying to bind a objectdatasource to a gridview. By doing this the most common way by adding an objectdatasource to the page and by using the wizard to...
1
1973
by: A_StClaire_ | last post by:
hi all, I am using a GridView bound to an ObjectDataSource. edit and delete functionality has been enabled. my ObjectDataSource is tied to a TableAdapter that accesses three stored procedures...
0
1803
by: David Hubbard | last post by:
I am using a GridView to display a set of objects that have a parent-child relationship. Each object, MyBO, has an ID property that is used to get the children of that object. class MyBO { ...
1
2161
by: syl | last post by:
Hello I am trying to create a "easy to use" gridview with filters (dropdownlist in headers), sorting...and much more.... In order to do that, i prefer to use a objectdatasource (ODS) beacause...
3
10258
by: pblack9455 | last post by:
I have a simple requirement to bind a small ArrayList of (ItemLine) Objects to a GridView control. The Gridview renders on the page and allows me to click update/edit buttons...however the data...
8
18068
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
1
8548
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but...
5
2624
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
4
12538
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void...
4
1786
by: Jonathan Wood | last post by:
Greetings, I have a GridView control. For a couple of reasons, I ended up with a TemplateField to contain my Edit and Delete links, something like this: <asp:TemplateField ShowHeader="False">...
0
7251
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
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7089
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
7517
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
5673
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,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.