PC Review


Reply
Thread Tools Rate Thread

Accessing DataItems of other DataListItems from the ItemDataBound event

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      25th May 2007
I am trying to access the DataItem of other DataListItems in a DataList of
mine from within the ItemDataBound. The code I am currently using is:

CStr(CType(Me.datMain.Items(e.Item.ItemIndex - 1).DataItem,
DataRowView).Row("id"))

However, this gives me an error stating that the object cannot be found.
What am I doing wrong? Thanks.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      27th May 2007
My guess is that the DataItem property is available only for the item that
fired the ItemDataBound event. There is no any connection between the
datalist items and their data items after the formers got bound.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am trying to access the DataItem of other DataListItems in a DataList of
>mine from within the ItemDataBound. The code I am currently using is:
>
> CStr(CType(Me.datMain.Items(e.Item.ItemIndex - 1).DataItem,
> DataRowView).Row("id"))
>
> However, this gives me an error stating that the object cannot be found.
> What am I doing wrong? Thanks.
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>



 
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
Accessing Ignored Class Properties during ItemDataBound =?Utf-8?B?VEI=?= Microsoft Dot NET 0 5th Oct 2005 09:11 PM
Accessing the current DataRow of the DataSource from ItemDataBound Nathan Sokalski Microsoft ADO .NET 5 25th Sep 2005 03:10 PM
Accessing the current DataRow of the DataSource from ItemDataBound Nathan Sokalski Microsoft ASP .NET 5 25th Sep 2005 03:10 PM
Accessing the current DataRow of the DataSource from ItemDataBound Nathan Sokalski Microsoft VB .NET 5 25th Sep 2005 03:10 PM
problem accessing e.Item.Cells[1].Controls[0].Text in itemdatabound Gerald DeConto Microsoft Dot NET Framework 2 9th Aug 2004 09:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:18 PM.