asp.net <%%> <%#%><%=%><%@%><%$%>用法与区别
1.<% %>用来绑定后台代码
如:
< %
for(int i=0;i<100;i++)
{
Reaponse.Write(i.ToString());
}
%>
2.<%# %> 是在绑定控件DataBind()方法执行时被执行,用于数据绑定
如: < %# Container.DataItem("title") %>
3.<%= %>用来绑定后台的变量或方法且有返回值 的,但此时的变量名或方法的访问修饰符为protected或public
如:<%=name%> <%=getstr()%>
4.<%@ %>用来导入后台命名空间
如:<%@ import namespace="system.data">
5.<%$ %>用来绑定web.config里的字符串(键值对)
如:<asp:TextBox runat="server" ID="cc" Text="<%$ ConnectionStrings:pubs%>"></asp:TextBox>
web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="pubs" connectionString="Server=.;database=pubs;uid=sa;pwd=" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
6.DataBind,获得的数据,系统会将其默认为String,怎样转化为其它的类型?
DataBinder.eval_r(Container.DataItem,"转换的类型","格式") 注:格式可以不要 此方法=eval_r("转换的类型")
asp.net <%%> <%#%><%=%><%@%><%$%>用法与区别的更多相关文章
- asp.net <%%> <%#%><%=%><%@%><%$%>用法区别
asp.net <%%>&<%#%>&<%=%>&<%@%>&<%$%>用法区别 1.<% %> ...
- 浅谈JS中的!=、== 、!==、===的用法和区别 JS中Null与Undefined的区别 读取XML文件 获取路径的方式 C#中Cookie,Session,Application的用法与区别? c#反射 抽象工厂
浅谈JS中的!=.== .!==.===的用法和区别 var num = 1; var str = '1'; var test = 1; test == num //tr ...
- [转载]jQuery中wrap、wrapAll和wrapInner用法以及区别
原文地址:jQuery中wrap.wrapAll和wrapInner用法以及区别作者:伊少君 原文: <ul> <li title='苹果'>苹果</li> ...
- WordPress翻译中 __()、_e()、_x、_ex 和 _n 的用法及区别
编译函数 WordPress使用了下面几个函数来方便语言本地化. __() _e() _x() _ex() _n() 以上所列的函数是用来包含所需翻译的字符串的,根据字符串的不同参数和输出类型,需要使 ...
- typedef和#define的用法与区别
typedef和#define的用法与区别 typedef和#define的用法与区别 一.typedef的用法 在C/C++语言中,typedef常用来定义一个标识符及关键字的别名,它是语言编译过程 ...
- SQL语句中count(1)count(*)count(字段)用法的区别
SQL语句中count(1)count(*)count(字段)用法的区别 在SQL语句中count函数是最常用的函数之一,count函数是用来统计表中记录数的一个函数, 一. count(1)和cou ...
- Collection List Set和Map用法与区别
labels:Collection List Set和Map用法与区别 java 散列表 集合 Collection 接 口的接口 对 象的集合 ├ List ...
- jQuery 中 children() 与 find() 用法的区别
1.children() 与 find() 用法的区别 通过children获取的是该元素的下级元素,而通过find获取的是该元素的下级所有元素.
- Linux中yum和apt-get用法及区别
Linux中yum和apt-get用法及区别 一般来说著名的linux系统基本上分两大类: 1.RedHat系列:Redhat.Centos.Fedora等 2.Debian系列:Debi ...
随机推荐
- HDU 5937 Equation 【DFS+剪枝】 (2016年中国大学生程序设计竞赛(杭州))
Equation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total S ...
- Installing Windows Identity Foundation on Windows 8 - The Certificate for the signer of the message is invalid or not found.
Just a very quick note here, in case you’re struggling to get Windows Identity Foundation installed ...
- 397. Integer Replacement
先正统做法. public class Solution { public int integerReplacement(int n) { if(n == 1) return 0; int res = ...
- (7/18)重学Standford_iOS7开发_视图、绘制、手势识别_课程笔记
第七课: 1.View 一般来说,视图是一个构造块,代表屏幕上一块矩形区域,定义了一个坐标空间,并在其中绘制及添加触控事件等. ①视图的层级关系 一个视图只能有一个父视图,可以有多个子视图 - ( - ...
- (转)BAT及各大互联网公司2014前端笔试面试题--Html,Css篇
BAT及各大互联网公司2014前端笔试面试题--Html,Css篇 很多面试题是我自己面试BAT亲身经历碰到的.整理分享出来希望更多的前端er共同进步吧,不仅适用于求职者,对于巩固复习前端基础更是 ...
- How to easily concatenate text based on criteria in Excel? 如何将Excel中的文本按条件合并
To combine text with the unique ID numbers, you can extract the unique values first and then create ...
- SystemTimeToFileTime、FileTimeToLocalFileTime、LocalFileTimeToFileTime三函数的跨平台实现
// test.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <stdlib.h> #include & ...
- Android自动关机代码
http://www.open-open.com/lib/view/open1409209890713.html 要实现自动关机的功能需要手机有root权限,如果手机有root权限,运行该程序时,会提 ...
- soap实例入门(转)
SOAP的HelloWord实例- - 1.1 前言 2005-3-2公司开会并分给我一个任务:写一个程序从福建移动的BOSS系统取出一些相关数据.我得到的资料仅仅有一个“福建移动BOSS与业务增值 ...
- [Java Performance] 数据库性能最佳实践 - JPA和读写优化
数据库性能最佳实践 当应用须要连接数据库时.那么应用的性能就可能收到数据库性能的影响. 比方当数据库的I/O能力存在限制,或者因缺失了索引而导致运行的SQL语句须要对整张表进行遍历.对于这些问题.只相 ...