Another topic about getting data from ItemTemplate in DataGrid

I

Isoaxis

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") %>&nbsp;
<%# 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
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top