我正在尝试使用WebForms从盒式磁带编写这种风格的代码。这可能吗?
@{
var message = "Hello World!";
Bundles.AddInlineScript(
@<script>
if (someTest) {
alert('@message');
}
</script>);
}
我还没有设法在 WebForms 中找到使用带有 Func<Object, Object>
参数的方法的示例。还是因为只有 Razor 视图引擎才允许这样做?
<% Bundles.AddInlineScript("if (someTest) { ...") %>