views:

130

answers:

1

I have a listview and a label in the ItemTemplate, i have set the text to

<asp:Label id="GreenDate" runat="server" Text='<%# Eval("NewsDate") %>'></asp:Label>

but i want to manipulate the value returned by datasource,which is Eval("NewsDate") and show the new value in the label. in which event i can access this value and how?

A: 

Use the following Event: ItemDataBound, and use DataBinder.Eval(e.Item.DataItem, "NewsDate") which is equivalent to this <%# Eval("NewsDate") %>.

Here's the syntax to get the Label Control:

Label lbl = (Label) Item.Controls.FindControlByID("GreenDate");
Madi D.
Thanks it worked perfectly
Mahdi