473,548 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing DataItems of other DataListItems from the ItemDataBound event

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.d atMain.Items(e. Item.ItemIndex - 1).DataItem,
DataRowView).Ro w("id"))

However, this gives me an error stating that the object cannot be found.
What am I doing wrong? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
May 26 '07 #1
1 1237
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" <nj********@hot mail.comwrote in message
news:uM******** ******@TK2MSFTN GP03.phx.gbl...
>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.d atMain.Items(e. Item.ItemIndex - 1).DataItem,
DataRowView).Ro w("id"))

However, this gives me an error stating that the object cannot be found.
What am I doing wrong? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

May 27 '07 #2

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

Similar topics

0
1131
by: TB | last post by:
(re-wording a previous post.. this makes much more sense, sorry for any duplication) First off, I've got three classes: Class MyItem Public PropertyOne As String Public PropertyTwo As String Public PropertyThree As String Public ItemError As MyItemError
3
14701
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
2
2615
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four columns. Three are databound to a dataset and one is a template column. I need to be able to access each item in the template column (getting...
3
7203
by: Clouds | last post by:
Hi ! How do I add the dynamic event handler for a dropdownlist present in the itemtemplate of a datalist !! I am doing it in the itemdatabound event of the datalist but it doesnt work... I am also setting the autopostback property to true for the dropdown list and it works but the handler doesnt get invoked at runtime... I have to do it in...
5
4295
by: qwerty | last post by:
I have tried to call the Repeater´s item´s DataItem example from Page´s functions. I have put to the Repeater ID and Name got from the database. I have tried following: CType(Repeater(index).DataItem, DataRowView)("ID") DataBinder.Eval(Repeater(index).DataItem, "ID") First get me "NullReferenceException" and second zero length string.
2
2270
by: tshad | last post by:
I am trying to hide all my datalistitems, which contain labels, textboxes a datagrid, etc. I want to show each datalist item one at a time on the page as the user pages through it. I tried: for each oItem as DataListItem in DataList1.Items oItem.Visible = false And that doesn't seem to work.
0
964
by: tshad | last post by:
I want to be able to allow my users to move DataListItems up and down without going back to the database. I assumed that your DataListItems were only pointers ( I am probably wrong here) and would be able to move the pointers around, but that doesn't seem to be the case. I tried this: Dim oItem as DataListItem oItem = oList.Items(1)...
1
2654
by: greenb | last post by:
I'm using the ItemDataBound event of the DataGrid to highlight cells that are outside an acceptable range. Each row has a button column (CommandName='Select'), that is used to display addtional details below the grid. When the page first loads and when the 1st button column is clicked, the ItemDataBound event fires for each row in the...
1
7188
by: Nathan Sokalski | last post by:
I need to access one of the columns from the current DataItem in the ItemCommand event, which I call using EventBubbling with a DataList and Button control. The code I tried to use to access the current DataItem is the following: CStr(CType(e.Item.DataItem, DataRowView)("id")) However, after some experimenting, I found out that...
0
7438
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7951
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...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6036
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5362
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...
0
5082
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...
0
3495
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...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
751
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...

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.