I have this line of markup
<a id="cashout_btn" href="#" data-tooltiptext="<%=this.CashOutTooltip%>" runat="server">
<span id="cashout_txt" class="cashout_txt" runat="server"> 150</span>
</a>
But on client side I see:
<a href="../Controls/Network开发者_StackOverflow中文版PAU/#" id="networkPauControl_cashoutControl_cashout_btn"
data-tooltiptext="<%=this.CashOutTooltip%>"
data-tooltiptype="simpleTip"><span id="networkPauControl_cashoutControl_cashout_txt" class="cashout_txt">
150</span> </a>
Meaning no string was populated in data-tooltiptext="<%=this.CashOutTooltip%>"
Any idea?
You can't use such evaluations in server controls' markup.
Best solution would be do that in code-behind, for example, during Page.Load event, but instead of giving you a sample of that, I'd argue that using localization would be better for that case.
You can start learning more by following this link:
- http://msdn.microsoft.com/en-us/library/fw69ke6f.aspx
<%= expressions
cannot be used as properties
, you have to use <%# expressions
instead.
Since <%# expressions
are evaluated at DataBind()
time, if you used that, then you need to call DataBind();
method at PreRenderComplete like..
protected void Page_PreRenderComplete(object sender, EventArgs e)
{
DataBind();
}
The solution was: a. using <%# instead of <%= b. removing "this" in <%=this.CashOutTooltip%> (Not sure why? Because "this" relates to the page and not the an instance of the class in the code behond ??)
精彩评论