473,387 Members | 1,641 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,387 software developers and data experts.

How to bind a CollectionList to a Dataset ????

Dear all,

Does anyone know how to bind a System.Collection.ArraysList object to a
Dataset ?

Thanks for your reply

Regards
Serge
Nov 22 '05 #1
3 3262
What do you mean by "Bind to a DataSet"?

If you mean binding like binding data to a control to show data, then you
can't. DataSet is not a control, it only exists in memory, you do not see
it.

If you mean to use data in the collection to make a DataSet, then yes (but
not binding, it has specific meaning). Simply declare and instantiate a
DataSet, add table to it and add rows to table, then use the data to
populate the rows.

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:C3**********************************@microsof t.com...
Dear all,

Does anyone know how to bind a System.Collection.ArraysList object to a
Dataset ?

Thanks for your reply

Regards
Serge

Nov 22 '05 #2
HI,

That was exactly was I was doing, polulating the dataset with the content of
the arraylist collection. Actually after that work I bind the dataset to a
datagrid.

Actually the sequence I do is:
filling up my arrayList with some incoming data
Fill a datatable with rows of my arrayList data
Add the table to the dataset
Bind the dataset to a datagrid

I was thinking if tehre was a straight wayh to bind directly the arrayList
to the datagrid then ?

regards
serge
"Norman Yuan" wrote:
What do you mean by "Bind to a DataSet"?

If you mean binding like binding data to a control to show data, then you
can't. DataSet is not a control, it only exists in memory, you do not see
it.

If you mean to use data in the collection to make a DataSet, then yes (but
not binding, it has specific meaning). Simply declare and instantiate a
DataSet, add table to it and add rows to table, then use the data to
populate the rows.

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:C3**********************************@microsof t.com...
Dear all,

Does anyone know how to bind a System.Collection.ArraysList object to a
Dataset ?

Thanks for your reply

Regards
Serge


Nov 22 '05 #3
You cannot bind the ArrayList to the DataGrid but you can bind an IList.
Since ArrayList implements the IList interface you can cast the Arraylist
like so:
DataGrid.DataSource = (IList)ArrayList

Then all you have to do is set the DataGrid columns to any public properies
exposed by the items in your ArrayList and call the DataBind method of the
DataGrid.

It's just that easy...

--
Message posted via http://www.dotnetmonster.com
Nov 22 '05 #4

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

Similar topics

0
by: serge calderara | last post by:
Dear all, Does anyone know how to bind a System.Collection.ArraysList object to a Dataset ? Thanks for your reply Regards Serge
3
by: Steve | last post by:
C# I have some combo boxes, full of lookup descriptions. When I retrieve a dataset for my record, the values that need binding to the combos are the actual record IDs that relate to these...
3
by: AFN | last post by:
I need to manually create the data to be shown in a datagrid (or some data table object). Should I create an array and bind the array to the datagrid OR should I create a temporary dataset and...
7
by: Jed | last post by:
I have a web service method that returns an array of custom objects marked serializeable with fully described public properties. When I bind the results to a DataGrid I can access the properties...
3
by: MrMike | last post by:
Hi. I have a dataset on my webform which I successfully fill by calling a Sub that occurs after the Page_Load. My question is - I have a textbox control which I need to populate with the contents...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
1
by: cipcip | last post by:
hi, is there a way to bind a menu control with a dataset without get this error? System.InvalidOperationException: HierarchicalDataBoundControl only accepts data sources that implement...
0
by: JP2006 | last post by:
I'm having an issue with a control I'm writing to consume RSS feeds. It gets a feed via a querystring parameter and sticks it in a dataset. I then use the dataset to write out the feed title and...
1
by: MariaKhan | last post by:
?? bind DataSet with listbox ??? ?? bind DataSet with listbox ??? ?? bind DataSet with listbox ??? ?? bind DataSet with listbox ??? ?? bind DataSet with listbox ???
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.