473,473 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How does DataList Itemcommand handler knows the value of its contr

Hi,

In a Datagrid ItemCommand Handler, I can use e.item.cells(0).text to get the
value of the second column of the current row.

Is there something similar in DataList? Say I have 1 databound column
defined using <%# Databinder.eval(Container.DataItem, "CustomerID") %> tag,
how do I get CustomerID of the current row in ItemCommand handler?

TIA
Nov 18 '05 #1
1 1940
Ed,
There are typically better ways of going about this, such as using the
DataKeys property, or using commandArguments.

You can always do something like:
<input type="hidden" value='<%# Databinder.eval(Container.DataItem,
"CustomerID") %>' runat="server" id="customerId" />

dim input as HtmlInputHidden = ctype(e.Item.FindControl("customerId"),
HtmlInputHidden)
dim customerId as integer = cint(input.Value)

check out my databinding tutorial for more information:
http://openmymind.net/databinding/index.html

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Ed Chiu" <Ed****@discussions.microsoft.com> wrote in message
news:3A**********************************@microsof t.com...
Hi,

In a Datagrid ItemCommand Handler, I can use e.item.cells(0).text to get the value of the second column of the current row.

Is there something similar in DataList? Say I have 1 databound column
defined using <%# Databinder.eval(Container.DataItem, "CustomerID") %> tag, how do I get CustomerID of the current row in ItemCommand handler?

TIA

Nov 18 '05 #2

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

Similar topics

2
by: Chris Fink | last post by:
Hello, I have a datalist that contains an asp button. I have the need to pass a value that is bound to my datalist along the button when the on_click event is fired. My datalist creates a button...
3
by: Hartmut Schroth | last post by:
Hi, I need a solution for the following problem: In the item template of a datalist control I have already a button control with the commandname set to "select" to perform some specific...
2
by: Mark | last post by:
I have a datalist (see code below). Assume that the datalist is populated with 10 records of data. How do I programatically grab all the data in ALL the columns of the selected record? I've been...
2
by: Jim Heavey | last post by:
I have a datalist control and when edit mode, I have three buttons, one for delete, one for cancel and one for Update. My Update button is not causing anything to happen. The other two events...
3
by: Chris | last post by:
Hi Folks, well I have this "small" problem with the footertemplate in a datalist. I added a button and a textbox to update the db with the given String of the Textbox. I already searched for...
2
by: Shiju Poyilil | last post by:
Hi ! I have a requirement wherein i am binding a datalist which contains a label (Caption for the field) and some literal hidden fields and a dropdown list. When I am binding to the datalist.....
5
by: TCORDON | last post by:
I have a DataList with a bunch of items (eg. Shoppiong Cart) each Item has a Remove button, in the code Behind page I have a Sub called Remove Item which calls a Function like this: Public...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
1
by: Nathan Sokalski | last post by:
I have a custom Control that I have made that contains a DataList. In either the ItemCommand or SelectedIndexChanged event I need to retrieve a value from the DataItem of the SelectedItem. I have...
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...
0
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...
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,...
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...
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: 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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 ...

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.