一个html数据编辑模板
#*define[
var tableInfo = CodeFactoryAddin.Base.DBTableInfo,CodeFactoryAddin.Base;/*表结构信息*/
var namePrefix = System.String;/*参数名称前缀*/
var itemname =System.String;/*变量名*/
]*#
#set($table=$tableInfo.Table)
#if(!$itemname)
#set($itemname=$table.Name)
#end
<%
bool isnull;
$table.Name $itemname = GetData<$table.Name>("$table.Name",ref isnull);
%>
<table>
#foreach($item in $table.Fields)
#if($item.Select)
<tr><td>$!{item.Name}:</td><td><input type="text" name="#if($namePrefix)$!{namePrefix}.#end$!{item.Name}"
value="<%=!isnull?$!{itemname}.$!{item.Name}:"" %>" /></td></tr>
#end
#end
</table>
用例生成效果
<%
bool isnull= false;
Categories cate = GetData<Categories>("Categories", ref isnull);
%>
<form action="DataAdd.aspx" method="post">
<%=!isnull?cate.CategoryID.ToString():"" %>
<table>
<tr>
<td>
CategoryName:
</td>
<td>
<input type="text" name="item.CategoryName" value="<%=!isnull?cate.CategoryName:"" %>" />
</td>
</tr>
<tr>
<td>
Description:
</td>
<td>
<input type="text" name="item.Description" value="<%=!isnull?cate.Description:"" %>" />
</td>
</tr>
</table>