ascx 中的内联动态字符串
这不会执行分隔符(它在确认对话框中逐字显示)。为什么不呢?另外,该变量是在代码隐藏中设置的,但在调用 PreRender 时已准备就绪,所以我应该没问题吧?
<asp:LinkButton ... OnClientClick=
"return confirm('Are you sure you want to remove Contract
Period <%= ContractPeriod_N.Text %>?');" />
This doesn't execute the delimiter (its displayed verbatim in the confirm dialog). Why not? Also, that variable is set in the codebehind, but is ready by the time PreRender gets called, so I should be OK right?
<asp:LinkButton ... OnClientClick=
"return confirm('Are you sure you want to remove Contract
Period <%= ContractPeriod_N.Text %>?');" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试在后面的代码中执行此操作:
Try doing it in the code behind:
您需要设置该属性,以便它全部来自渲染块或完全不来自渲染块。尝试一下
You need to set the property so that it is all from a render block or completely with out. Give this a try
当然没有执行。它位于字符串文字的中间。如果您想将
<%
文本放在字符串中的某处,该怎么办?Of course it's not executed. It's in the middle of a string literal. What would do if you wanted to have the
<%
text in a string somewhere?查看我对另一个问题的回答 这里。我相信您可以使用类似于
您的标记的自定义 ExpressionBuilder 来完成您想要的任务,然后您的标记将如下所示:
See my answer to a different question here. I believe you can accomplish what you want using a custom ExpressionBuilder similar to
Your markup would then look like:
如果您使用数据绑定,则可以这样设置
If you are using databinding then you can set it this way