<%%>在ASP.NET中(嵌入式代码块) [英] <% %> in ASP.NET (embedded code blocks)

查看:51
本文介绍了<%%>在ASP.NET中(嵌入式代码块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解这些在aspx页面的标记中表示什么……但是我不知道它们可以用来发挥全部功能,甚至不代表这些特殊指令的名称.

I understand what these signify in the markup of the aspx pages ... but I don't not know the full power they can be used for or even the name to denote these special directives.

示例:

我可以放置ifs或switch之类的条件语句

can i put conditional statements like ifs or switches

例如,我已经看到并使用它们来绑定数据集中的数据

I have seen and used them to bind data from a data set for example

任何输入都将不胜感激

推荐答案

这些是代码块标记.

是的,您可以将服务器端代码包装在这些标记中(C#中的示例)

And yes you can wrap serverside code in these tags (examples in C#)

<% if (x = y) {
  } else {
  }
%>

OR

<% if (x = y) {%>
   Write this HTML
<%  } else {%>
   Write this html
<%  }%>

还有

<%= SomeVar%> 会将SomeVar放入HTML

This <%=SomeVar %> Which will out put SomeVar to HTML

这篇关于&lt;%%&gt;在ASP.NET中(嵌入式代码块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆