在网络表单属性内嵌code [英] Inline Code on Webform Property
本文介绍了在网络表单属性内嵌code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么没有这个显示渲染时的日期/时间?
Why doesn't this display the date/time when rendered?
<asp:Label runat="server" ID="test" Text="<%= DateTime.Now.ToString() %>" ></asp:Label>
反正有使这项工作?
Is there anyway to make this work?
推荐答案
Asp.net服务器控件不发挥出色的&lt;%=,而不是你可以这样做:
Asp.net server controls don't play well with the <%=, instead you can do:
<span><%= DateTime.Now.ToString() %></span>
诗。你可以另外设置标签的上$ C $文本C-后面。它可能适用于您的情况来设置它在preRenderComplete。
Ps. you could alternatively set the label's text on the code-behind. It might work for your scenario to set it on the PreRenderComplete.
这篇关于在网络表单属性内嵌code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文