I've read the 1000's of topics about accessing the text contained in
ItemTemplates, but I'm still having a problem.
Here's an excerpt my ASPX code:
<ItemTemplate>
<asp:Label ID="lblAppliesTo" Runat="server">
<%# DataBinder.Eval(Container, "DataItem.Manufacturer") %>
<%# DataBinder.Eval(Container, "DataItem.Model") %>
</asp:Label>
</ItemTemplate>
Here's my codebehind:
Label lblAppliesTo =
(Label)e.Item.Cells[3].FindControl("lblAppliesTo");
string appliesTo = lblAppliesTo.Text;
The index is correct.
The page displays the data in the grid correctly upon page load.
Here's the funny part. The above code returns an empty string for
appliesTo, but I can set the text of the label in this method without a
hitch and display the changed value. It's like it found the control,
but won't give me the current text.
Any ideas?
thanks,
..brit