惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
S
SegmentFault 最新的问题
V
Visual Studio Blog
J
Java Code Geeks
宝玉的分享
宝玉的分享
美团技术团队
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
有赞技术团队
有赞技术团队
量子位
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
博客园 - 叶小钗
月光博客
月光博客
P
Proofpoint News Feed
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog

博客园 - Kent

55种网页常用小技巧 - Kent - 博客园 (转文)IP Domain etc. javascript setTimeout 和 setInterval CodeFile、Src、Codebehind三者的差别解释 - Kent - 博客园 Microsoft SQL Server 2005的国际功能(转贴) SQL Server 中易混淆的数据类型 关于 SQL Server 使用 Unicode 数据 Sys.WebForms.PageRequestManagerParserErrorException 错误的解决办法 SQLserver2005中的四个评价函数 常用DOS命令(转贴) 类的一般标准写法 正则表达式(regular expression) C#: 为datatable添加column的方法 C#:List 取代数组的方法 javascript:parseFloat javascript:trim function javascript: split & array javascript:eval function Javascript: Replace function.
C#: 三种符号的区别
Kent · 2006-09-23 · via 博客园 - Kent

<%%>是直接写代码用的.ASP的写法
<%=%>是直接输出=号后表达示的值
<%#%> 数据绑定用的

1.在aspx页面里可以用<%%>来加一些判断,按条件来生HTML语句.
<%
  if(IsLink==true)  
  {
  %>
  <SCRIPT language="javascript" id="clientEventHandlersJS" src="/Root/js/JS1.js"></SCRIPT>
  <%
  }
  else
  {
  %>
  <SCRIPT language="javascript" id="clientEventHandlersJS2" src="/Root/js/jS2.js"></SCRIPT>
  <%
  }
  %>


2.而<%=%>可以直接在一串html里嵌入C#代码。如cs里面的Session.
<LINK href='/Root/css<%=Session["GUI"].ToString().Trim()%>/Default.css' type=text/css rel=stylesheet >


3.<%#%>是用于数据绑定的。如下面的是在datagrid里的TemplateColumn,

 <asp:TemplateColumn Visible="False">
                      <ItemTemplate>
                       <asp:TextBox ID="MyID" Runat=server style="DISPLAY:none" Text='<%# DataBinder.Eval(Container.DataItem,"ColumnName") %>'>
                       </asp:TextBox>
                      </ItemTemplate>