以下是我实现的模板文件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}
{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());
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>
<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>