How does DataList Itemcommand handler knows the value of its contr

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top