473,587 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ 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.Data Item, "CustomerID ") %> tag,
how do I get CustomerID of the current row in ItemCommand handler?

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

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

dim input as HtmlInputHidden = ctype(e.Item.Fi ndControl("cust omerId"),
HtmlInputHidden )
dim customerId as integer = cint(input.Valu e)

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****@discuss ions.microsoft. com> wrote in message
news:3A******** *************** ***********@mic rosoft.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.Data Item, "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
14327
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 for each row in my datasource, so each button needs to pass a unique value. My questions are: 1. How do I pass the value with the button without...
3
2514
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 database action. I additionally want to update an integer value in the underlying data source by simply clicking an a check box or an imagebutton...
2
527
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 trying to use the FindControl method inside the ItemCommand event of the DataList to get the contents of the Label below, but it appears that the...
2
1466
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 work just fine. I thought the way in knows which event to fire is by the "CommandName" My button looks like the following: <asp:Button...
3
1726
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 it and know now, that I have to place the handling in Itemcreated. So when I click on the button everything is fine except when the sub...
2
3040
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.. only the labels (caption) and the invisible literal controls are binded.. Now based on the invisible literal control values I get the information from...
5
1235
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 Shared Function RemoveItem (t_ItemIndex as Integer) as String This function removes the item from the DB. My question is, first how do I tie up the...
4
4033
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 work:( Thanks My CheckBoxList in the DataList Below
1
6746
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 tried the following two techniques: Private Sub datProductList_ItemCommand(ByVal source As Object, ByVal e As...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8205
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7967
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
6619
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
5712
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
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
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 we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
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.