PC Review


Reply
Thread Tools Rate Thread

Cannot bind an arraylist to a datagrid asp.net

 
 
Farook
Guest
Posts: n/a
 
      23rd Jan 2008
Hi,

I have looked around for a solution to my problem with no results. My issue
is that I cannot bind an arraylist to a datagrid control in asp.net.

My code snippet:
For Each ........
.........
.........
While dbread.Read()
MyArrayList.add(dbread("iHawb"))
MyArrayList.add(dbread("iDate"))
MyArrayList.add(dbread("iTime"))
MyArrayList.add(dbread("iStatus"))
MyArrayList.TrimToSize()
End While

Next

datagrid1.DataSource = MyArrayList
datagrid1.DataBind()

The error message:
A field or property with the name 'iHawb' was
not found on the selected data
source.

The error is because binding to a datagrid requires iList. A Radio Button,
Drop Down List, etc can be bound but not a Datagrid,Datalist or a
Datarepeater.

Kind Regards
Farook

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to bind a repeater with an arraylist psycho Microsoft ASP .NET 4 3rd Jan 2008 01:31 PM
arraylist inside an arraylist for datagrid, gridview rjl Microsoft C# .NET 4 13th Apr 2006 07:32 PM
bind specific elements of arraylist to datagrid Harry Microsoft C# .NET 1 14th Jul 2005 04:03 AM
DataGrid Bind to DataSet, then Bind to DaTaview, GOT ERROR...PLS HELP A_PK Microsoft Dot NET Compact Framework 16 13th Apr 2005 04:27 AM
DataGrid Bind to DataSet, then Bind to DaTaview, GOT ERROR...PLS HELP A_PK Microsoft VB .NET 17 13th Apr 2005 04:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:49 AM.