J
jjack100
I want to set the text value of a label that is within a datalist in
the codebehind. Does this have to be done in the databound event?
Simplified example:
<aspataList id="dlItem" runat="server">
<ItemTemplate>
<asp:Label ID="lblItemPrice" runat="server" />
</ItemTemplate>
</aspataList>
in codebehind:
Label lblPrice = (Label) dlItem.Controls[0].FindControl("lblPrice");
lblPrice.Text = someValue;
I really just want to know how to access the label explicitly.
Basically, the databinding on the datalist is getting values from a
datareader, but the label does not. For layout purposes, however, the
label needs to be nested within the datalist.
the codebehind. Does this have to be done in the databound event?
Simplified example:
<aspataList id="dlItem" runat="server">
<ItemTemplate>
<asp:Label ID="lblItemPrice" runat="server" />
</ItemTemplate>
</aspataList>
in codebehind:
Label lblPrice = (Label) dlItem.Controls[0].FindControl("lblPrice");
lblPrice.Text = someValue;
I really just want to know how to access the label explicitly.
Basically, the databinding on the datalist is getting values from a
datareader, but the label does not. For layout purposes, however, the
label needs to be nested within the datalist.