For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > November 2004 > How does DataList Itemcommand handler knows the value of its contr









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How does DataList Itemcommand handler knows the value of its contr
Ed Chiu

2004-11-30, 4:03 pm

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

2004-11-30, 4:03 pm

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" <EdChiu@discussions.microsoft.com> wrote in message
news:3AB23276-3D7A-429C-BEED-D2BC4511E5AA@microsoft.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



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com