Label text in datarepeater
I am trying to use a label in my datarepeater when I can bind data and write me an html page.
<asp:Label ID="lblID" runat="server"><%# DataBinder.Eval(Container.DataItem, "ID")%></asp:Label>
which works great.
When I try to get the text value, I get "".
LblcurrentID label = ri.FindControl ("lblID") as label,
Result: lblcurrentID.text = ""
this same code works great for the dropdown I have in the datarepeater. I'm wondering if this has anything to do with the label being converted to a span tag.
<span id="template6_middlecontent1mAzoaNominationApproval0_dataReaper_ctl01_lblID">2009040100000888213</span>
0
a source to share
2 answers
I ran into this problem before, I don't remember to actually find a solution to the problem, how work I used <asp:HiddenField>
to store information for me:
<asp:HiddenField runat="server" id="hiddenId" value='<%# Eval("Id") %>' />
Note the "instead of" wrapping Eval btw statement, .NET is fussy when you assign values to server controls.
0
a source to share