Bruno Piovan wrote:
Hi,
I have a datalist, this datalist has a label for each item called
lblId, this label hold the ID of each item. I need to write a
procedure that will use the value of the label of each item, I'm
using the FindControl method but the return value is aways "".
How do I get the text of the labels??
Did you use FindControl properly, like this (I use VB.NET):
Dim lblId As Label = CType(Item.FindControl("lblId"),Label)
A better way to find the IDs is to set the DataKeyField property
of the datalist to the name of the database field (probably "ID"),
and use DataList1.DataKeys(Item.ItemIndex) to get the value
of the ID.
--
Jos