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

Binding an arraylist to a datalist

I have datalist binding to an arraylist of custom objects (defined in a
class "PageItem"). What I am trying to do is access the source
PageItem object in an ItemCommand event handler of the DataList.
For example, I would like to do something like the following:
protected void dlPages_ItemCommand(object source,
DataListCommandEventArgs e)
{
(PageItem) thisPage = (PageItem)[...?? reference to the object
that this item is bound to...]
}

Thanks,

Nathan

Mar 6 '06 #1
1 1389
PageItem pageItem = (PageItem)e.Item.DataItem;

you'll want to make sure e.Item.ItemType is an Item or an AlternatingItem

--
http://www.openmymind.net/

<np*****@gmail.com> wrote in message
news:11**********************@j52g2000cwj.googlegr oups.com...
I have datalist binding to an arraylist of custom objects (defined in a
class "PageItem"). What I am trying to do is access the source
PageItem object in an ItemCommand event handler of the DataList.
For example, I would like to do something like the following:
protected void dlPages_ItemCommand(object source,
DataListCommandEventArgs e)
{
(PageItem) thisPage = (PageItem)[...?? reference to the object
that this item is bound to...]
}

Thanks,

Nathan

Mar 7 '06 #2

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

Similar topics

2
by: Charlie | last post by:
Hi: I'm trying to bind a DataList to an ArrayList of POC object instances. this.DataList.DataSource = BizEntity.thePOCs; // thePOCs is an ArrayList of POC's which is member of BizEntity class...
1
by: Laura K | last post by:
Can someone tell me where I went wrong. This is my code for binding data to a datalist. <script language="vb"> Sub Page_Load(Src As Object, e As EventArgs) Dim Con As New...
3
by: Jim Bancroft | last post by:
Hi everyone, I'm binding an ArrayList to a DataGrid for the first time (I'm used to binding DataSets and DataTables) and I was wondering if I could somehow "name" the ArrayList, so that I can...
3
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is...
4
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
3
by: Bob Lehmann | last post by:
Hi, I'm trying to bind an ArrayList to a DataList. I get the error DataBinder.Eval: 'System.String' does not contain a property with the name Name. I don't know what property of ArrayList...
5
by: Laura K | last post by:
I am having difficulty binding data to my datalist. The data list does not show. I have gone round and round for two days. I could really use some help looking through this code and seeing where...
1
by: PANDY | last post by:
how to bind an arraylist of object to datalist control in asp.net?
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.