zoukankan
html css js c++ java
我的模板分析引擎类PHP的.net开发方法功能介绍篇
从一开始接触asp.net我就不领微软的情,对其提供和包装的各大控件给人们带来的方便性视而不见,一直想实现自己的模板分析方案,但工作中一直是别人安排我做什么我就得做什么,根本没时间做自己想做的事情,所以自己的模板方案迟迟未能实现。不过最近因为项目的需要,我终于有机会实现它了。
以下是我实现的模板文件Skin-test.html
{repeater rptTables}
{headerTemplate}
<
div
id
="miniBox"
>
<
div
class
="hd"
>
<
div
class
="l"
>
1
</
div
>
<
div
class
="title"
>
{repeater rptTables2}{headerTemplate}55555{/headerTemplate}{/repeater}
</
div
>
<
div
class
="r"
>
3
</
div
>
</
div
>
{/headerTemplate}
{itemTemplate}
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="{eval TableId}"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid={eval TableId}"
>
{eval TableName}
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid={eval TableId}"
>
{lang Edit}
</
a
>
<
a
href
="EditTable.aspx?tableid={eval TableId}"
>
{lang Delete}
</
a
>
</
div
>
</
div
>
{/itemTemplate}
{alternatingItemTemplate}
<
div
class
="it2"
>
<
div
class
="l"
>
<
input
id
="{eval TableId}"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid={eval TableId}"
>
{eval TableName}
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid={eval TableId}"
>
{lang Edit}
</
a
>
<
a
href
="EditTable.aspx?tableid={eval TableId}"
>
{lang Delete}
</
a
>
</
div
>
</
div
>
{/alternatingItemTemplate}
{footerTemplate}
<
div
class
="ft"
>
<
select
id
="Select1"
>
<
option
value
=""
>
{lang Action}
</
option
>
<
option
value
=""
>
{lang Delete}
</
option
>
<
option
value
=""
>
{lang Build}
</
option
>
</
select
>
</
div
>
{repeater rptTables3}{headerTemplate}55555{/headerTemplate}{itemTemplate}{eval TableId}{/itemTemplate}{/repeater}
</
div
>
{/footerTemplate}
{/repeater}
以下是分析这个模板的代码:
PageSetting p
=
ResourceManager.GetPageSetting(context.Request.CurrentExecutionFilePath);
string
txt
=
Skins.GetSkin(p.SkinFile);
IUI.ITemplate tmp
=
UIFactory.DataAccess.CreateTemplate();
tmp.InstantiateIn(
ref
txt);
if
(tmp.ContainsKey(
"
rptTables
"
))
{
Repeater rpt
=
(Repeater)tmp.FindControl(
"
rptTables
"
);
Repeater rpt2
=
(Repeater)tmp.FindControl(
"
rptTables2
"
);
Repeater rpt3
=
(Repeater)tmp.FindControl(
"
rptTables3
"
);
List
<
TableInfo
>
ls
=
new
List
<
TableInfo
>
();
for
(
int
i
=
0
; i
<
10
; i
++
)
{
TableInfo _tblInfo
=
new
TableInfo();
_tblInfo.TableId
=
Guid.NewGuid();
_tblInfo.TableName
=
string
.Format(
"
table {0}
"
, i);
ls.Add(_tblInfo);
}
rpt.DataSource
=
ls;
rpt.DataBind();
rpt2.DataSource
=
ls;
rpt2.DataBind();
rpt3.DataSource
=
ls;
rpt3.DataBind();
}
context.Response.Write(tmp.Render());
以下是执行的结果:
<
div
id
="miniBox"
>
<
div
class
="hd"
>
<
div
class
="l"
>
1
</
div
>
<
div
class
="title"
>
55555
</
div
>
<
div
class
="r"
>
3
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="8f035f73-a025-4aaa-a9ab-9f6d475ee762"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=8f035f73-a025-4aaa-a9ab-9f6d475ee762"
>
table 0
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=8f035f73-a025-4aaa-a9ab-9f6d475ee762"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=8f035f73-a025-4aaa-a9ab-9f6d475ee762"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="6571e446-7c50-48a7-8195-167cddab6966"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=6571e446-7c50-48a7-8195-167cddab6966"
>
table 1
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=6571e446-7c50-48a7-8195-167cddab6966"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=6571e446-7c50-48a7-8195-167cddab6966"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="944a4cbc-3442-4d12-9c84-95f31d463e32"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=944a4cbc-3442-4d12-9c84-95f31d463e32"
>
table 2
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=944a4cbc-3442-4d12-9c84-95f31d463e32"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=944a4cbc-3442-4d12-9c84-95f31d463e32"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="879b8f82-0d97-4c44-8996-9eb3ab676481"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=879b8f82-0d97-4c44-8996-9eb3ab676481"
>
table 3
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=879b8f82-0d97-4c44-8996-9eb3ab676481"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=879b8f82-0d97-4c44-8996-9eb3ab676481"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="03452077-97b0-4236-b316-4856e3afde71"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=03452077-97b0-4236-b316-4856e3afde71"
>
table 4
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=03452077-97b0-4236-b316-4856e3afde71"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=03452077-97b0-4236-b316-4856e3afde71"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="277c9626-1667-4f94-8e9a-b4f94d7e4843"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=277c9626-1667-4f94-8e9a-b4f94d7e4843"
>
table 5
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=277c9626-1667-4f94-8e9a-b4f94d7e4843"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=277c9626-1667-4f94-8e9a-b4f94d7e4843"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="afe35db0-d07a-44fe-88be-db5ded717916"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=afe35db0-d07a-44fe-88be-db5ded717916"
>
table 6
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=afe35db0-d07a-44fe-88be-db5ded717916"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=afe35db0-d07a-44fe-88be-db5ded717916"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="3a2f445e-44c4-4144-84da-b08e2fb90d3b"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=3a2f445e-44c4-4144-84da-b08e2fb90d3b"
>
table 7
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=3a2f445e-44c4-4144-84da-b08e2fb90d3b"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=3a2f445e-44c4-4144-84da-b08e2fb90d3b"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="8d555e36-c4c7-4219-8f67-8305db9ae8d2"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=8d555e36-c4c7-4219-8f67-8305db9ae8d2"
>
table 8
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=8d555e36-c4c7-4219-8f67-8305db9ae8d2"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=8d555e36-c4c7-4219-8f67-8305db9ae8d2"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="it1"
>
<
div
class
="l"
>
<
input
id
="0edd6e3e-d1fc-4842-9832-d2e037f770ea"
type
="checkbox"
/>
<
a
href
="EditTable.aspx?tableid=0edd6e3e-d1fc-4842-9832-d2e037f770ea"
>
table 9
</
a
>
</
div
>
<
div
class
="r"
>
<
a
href
="EditTable.aspx?tableid=0edd6e3e-d1fc-4842-9832-d2e037f770ea"
>
edit
</
a
>
<
a
href
="EditTable.aspx?tableid=0edd6e3e-d1fc-4842-9832-d2e037f770ea"
>
delete
</
a
>
</
div
>
</
div
>
<
div
class
="ft"
>
<
select
id
="Select1"
>
<
option
value
=""
>
action
</
option
>
<
option
value
=""
>
delete
</
option
>
<
option
value
=""
>
Build
</
option
>
</
select
>
</
div
>
555558f035f73-a025-4aaa-a9ab-9f6d475ee7626571e446-7c50-48a7-8195-167cddab6966944a4cbc-3442-4d12-9c84-95f31d463e32879b8f82-0d97-4c44-8996-9eb3ab67648103452077-97b0-4236-b316-4856e3afde71277c9626-1667-4f94-8e9a-b4f94d7e4843afe35db0-d07a-44fe-88be-db5ded7179163a2f445e-44c4-4144-84da-b08e2fb90d3b8d555e36-c4c7-4219-8f67-8305db9ae8d20edd6e3e-d1fc-4842-9832-d2e037f770ea
</
div
>
查看全文
相关阅读:
React Native 安卓 程序运行报错: React Native version mismatch(转载)
RN用蓝牙接入热敏打印机和智能电子秤(转载)
安装加密用包
React Native 调用 Web3(1.x) 的正确姿势
Unable to resolve module crypto
点击<tr>表格行元素进行跳转
Phonegap环境配置
登录记住密码功能的实现
php+sqlserver实现分页效果
php日期格式转换
原文地址:https://www.cnblogs.com/afxcn/p/867453.html
最新文章
git 常用命令 整理
面试前复习
取url地址参数
vue新窗口跳转路由
显示时间特效
iOS webview缩小页面内容
iOS 拨打电话的三种方式总结
iOS html转换为字符串
iOS 验证手机号
MWPhotoBrowser使用
热门文章
Xcode Code Snippets Library 代码块的创建
Xcode6 打包ipa真机测试
iOS UItextView消除键盘
ios8 Xcode6 设置Launch Image 启动图片
IOS alpha导致subView也透明
关于TCP和MQTT之间的转换(转载)
react react-native 日期插件 m-date-picker / rmc-date-picker的使用
停止node进程和查看react-native-cli
携带cookie进行数据请求
C#如何运行外部程序(打开可执行程序):ShellExcute和Process
Copyright © 2011-2022 走看看