473,789 Members | 2,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView and ArrayList of Objects

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...howev er the data does not change, and in the
updated and updating row events the newValues collections are empty!!!

I've tried various other methods such as using an ObjectDataSourc e, but my
ArrayList does not existing in a database until after the editing and
updating in the gridview is complete and the form completes. Also how can we
control or preinitialise the ObjectDataSourc e with a subset of data... anyway
I'd prefer to use the ArrayList of Objects (my ItemLine objects).

Am I attempting to do the impossible? Each ItemLine object has a property
ItemLn which is the sequential primary key; also an ItemDate, Desc and an
Amount.

I am lost!!
Nov 26 '06 #1
3 10275
An ObjectDataSourc e can be used without any interaction with a database at
all. The class that provides the data can get it or "preinitial ize" it from
any source.
Here is an example where I use an ObjectDataSourc e to get RSS feeds:

http://www.eggheadcafe.com/tutorials...atasource.aspx

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"pblack9455 " wrote:
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...howev er the data does not change, and in the
updated and updating row events the newValues collections are empty!!!

I've tried various other methods such as using an ObjectDataSourc e, but my
ArrayList does not existing in a database until after the editing and
updating in the gridview is complete and the form completes. Also how can we
control or preinitialise the ObjectDataSourc e with a subset of data... anyway
I'd prefer to use the ArrayList of Objects (my ItemLine objects).

Am I attempting to do the impossible? Each ItemLine object has a property
ItemLn which is the sequential primary key; also an ItemDate, Desc and an
Amount.

I am lost!!
Nov 26 '06 #2
Yeah thats great but its still taking its data from a single source for all
GridView controls that use the objectdatasourc e specified. Sorry I omitted
the main requirement to have the application preinitialise the 'datasource'
for each GridView... it similar to providing an array of data and nallow the
user to work on that data. I'm trying to use the GridView as a means of
collecting a set of item data from the user...for example invoice detail
lines.
"Peter Bromberg [C# MVP]" wrote:
An ObjectDataSourc e can be used without any interaction with a database at
all. The class that provides the data can get it or "preinitial ize" it from
any source.
Here is an example where I use an ObjectDataSourc e to get RSS feeds:

http://www.eggheadcafe.com/tutorials...atasource.aspx

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"pblack9455 " wrote:
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...howev er the data does not change, and in the
updated and updating row events the newValues collections are empty!!!

I've tried various other methods such as using an ObjectDataSourc e, but my
ArrayList does not existing in a database until after the editing and
updating in the gridview is complete and the form completes. Also how can we
control or preinitialise the ObjectDataSourc e with a subset of data... anyway
I'd prefer to use the ArrayList of Objects (my ItemLine objects).

Am I attempting to do the impossible? Each ItemLine object has a property
ItemLn which is the sequential primary key; also an ItemDate, Desc and an
Amount.

I am lost!!
Nov 26 '06 #3
Update: I can get the data in the array to change If I manually code in the
changes. What I can't seem to get working is collecting the new data values.
I've tried accessing e.NewValues but it always seems to be empty!!!

help!

"pblack9455 " wrote:
Yeah thats great but its still taking its data from a single source for all
GridView controls that use the objectdatasourc e specified. Sorry I omitted
the main requirement to have the application preinitialise the 'datasource'
for each GridView... it similar to providing an array of data and nallow the
user to work on that data. I'm trying to use the GridView as a means of
collecting a set of item data from the user...for example invoice detail
lines.
"Peter Bromberg [C# MVP]" wrote:
An ObjectDataSourc e can be used without any interaction with a database at
all. The class that provides the data can get it or "preinitial ize" it from
any source.
Here is an example where I use an ObjectDataSourc e to get RSS feeds:

http://www.eggheadcafe.com/tutorials...atasource.aspx

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"pblack9455 " wrote:
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...howev er the data does not change, and in the
updated and updating row events the newValues collections are empty!!!
>
I've tried various other methods such as using an ObjectDataSourc e, but my
ArrayList does not existing in a database until after the editing and
updating in the gridview is complete and the form completes. Also how can we
control or preinitialise the ObjectDataSourc e with a subset of data... anyway
I'd prefer to use the ArrayList of Objects (my ItemLine objects).
>
Am I attempting to do the impossible? Each ItemLine object has a property
ItemLn which is the sequential primary key; also an ItemDate, Desc and an
Amount.
>
I am lost!!
Nov 27 '06 #4

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

Similar topics

9
4315
by: TT ( Tom Tempelaere ) | last post by:
Hi At one point in my application I have a single ArrayList object that I need to break up in two Arraylist objects: the beginning part up to an index, and the ending part from a certain index. I am now using ArrayList.GetRange but the documentation states that this method does not create new ArrayList objects but views into the source ArrayList object ArrayList original // .. ArrayList l1 = original.GetRange( 0, count ) ArrayList l2 =...
3
13719
by: SpotNet | last post by:
Hi NewsGroup; Trying to construct a Multidimensional (2D more specifically) populated from an OleDbDataReader. Reason I'm using an ArrayList is I do not know the size of the first dimension (being rows), here's my final attempt below; System.Collections.ArrayList GetDataMatrix = New System.Collections.ArrayList; //Let's just say 10, 3 Keeping it brief and simple excuse the syntax,
3
10826
by: Daves | last post by:
is it possible? if so - how would you do it?
0
1438
by: stigbn | last post by:
When a DataSet is used as data source for a DataGrid one can get hiearachical datagrid by using relations among the DataTables of the DataSet. (By hierarchical datagrid, I mean columns that can be expanded and collapsed with '+' buttons). How can I achieve a hierarchical DataGrid when using an ArrayList as data source? I have tried binding ArrayList containing an ArrayList to the datagrid, but this just shows the public properties of...
15
8338
by: Sam | last post by:
Hi, I have the following code : Dim rNodeList As New ArrayList Dim rNodeListNew As New ArrayList For iCntr As Integer = 0 To tvRelations.Nodes.Count - 1 rNodeList.Add(tvRelations.Nodes(iCntr).Text) Next
8
1278
by: lgbjr | last post by:
Hi All, I have 10 arraylists in a VB.NET app. Based on the state of various checkboxes and radiobuttons, a set of data is read into these arraylists. I don't know how many of the arraylists will be used until runtime. what I'd like to do is something like this: Dim AL1 as New ArrayList ... Dim AL10 as New ArrayList
15
1714
by: GTi | last post by:
If I use: ArrayList TimeScale = new ArrayList(); TimeScale.Capacity = 1000; TimeScale="test 1" The last line trow me an error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
16
2970
by: vbnewbie | last post by:
I need to create a number of arraylists at run time. The number of arraylists to be created is unknown at design time. The name of the first newly created arraylist is the first element of an array, NameArray (a Publicly declared array with an unknown number of elements at design time). The name of the second newly created arraylist is the second element of NameArray, etc Problem 1: How can I retrieve that name from NameArray and...
2
1503
by: wbosw | last post by:
I have a Arraylist (SearchSkillsArray) that contains objects. I want to place those objects into a listbox. Here i'm using get enumerator to loop through the arraylist and add the objects to the listbox. I'm receiving the error Conversion from type 'SkillSearch' to type 'String' is not valid. Does anyone have any suggestion to fix this error? Thanks, wbosw SearchSkillsArray.Add(SkillSearch) ...
1
1326
by: gvi | last post by:
Hello everybody, Here is the scenario I am calling a webservice which is returning an object type. I need to bind that to the datagrid. So I thought I would ctype the object type to arraylist but I got the error message 'Specified cast not valid' I am not sure if I am approaching this in the correct way. Could you pls. help me out ? Thanks
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6761
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.