473,473 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Retreiving data in datalist from Codebehind

I have a page that uses a DataList control, and I need to get at the
data in the codebehind. I have done it in the HTML side of things with
the following command:

<%# DataBinder.Eval(Container.DataItem, "BodyItemName")%>

But how would I access this in the, say, "ItemCommand" event?

Thanks,

Christian

Nov 19 '05 #1
1 1726

<ka******@hotmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
I have a page that uses a DataList control, and I need to get at the
data in the codebehind. I have done it in the HTML side of things with
the following command:

<%# DataBinder.Eval(Container.DataItem, "BodyItemName")%>

But how would I access this in the, say, "ItemCommand" event?

You have index of "clicked" item in event arguments (second argument of
event handler) : e.Item.ItemIndex
Now when you know item number you can use it to find appropriate element of
data source which was used to populate datalist.
--
Artur Borecki
aboreckiATtenbit.pl
Nov 19 '05 #2

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

Similar topics

3
by: Colin Young | last post by:
I'm having a bit of a problem with my DataList when I try to update from the user's input. I've included relevant excerpts at the end of this message. In the UpdateCommand code, the...
4
by: Roger R. Smith | last post by:
Anyway I am having a problem with Web Service and DataList in ASP.NET. so the best way to explain it would be with the MSPetShop 3.0 Application. I submitted an order using the Forms on...
1
by: Mihai_Panait | last post by:
I'm trying to build a commerce site and i can't understand why my DataList controls acts diferent with the same code in the same page My database contains amoung others 'category', 'subcategory' and...
10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
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...
9
by: jjack100 | last post by:
I want to set the text value of a label that is within a datalist in the codebehind. Does this have to be done in the databound event? Simplified example: <asp:DataList id="dlItem"...
3
by: Patrick Olurotimi Ige | last post by:
Can i have a Button in a Datalist? The button is for posting a form to the the Database FOr example:- <ASP:DataList id="heading0" RepeatLayout="Flow" RepeatDirection="Horizontal" ...
2
by: Nathan Sokalski | last post by:
I am using a SortedList as my DataSource. However, one of the things I am using the data for is to generate the URL for the HyperLinks in my DataList. Therefore, I need to use the result of a...
1
by: =?Utf-8?B?U2FuZHBvaW50R3V5?= | last post by:
Im maintaining an app with a DataList, the first time Ive used this control. A single row is retrieved from the database and formatted on the screen using <%#...
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...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.