Repeater用法[转]
在网上看到一篇Repeater的用法,比较好,特转载
Repeater用法:
使用Repeater可以绘制表头、表内、表尾比较复杂的表格,如以下实例:
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<!—表格开 始位置-à
<table cellpadding='0' cellspacing='0' bordercolor="#3399FF" border="1" >
<tr align=center style="height:20px;">
<td width="4%" align="center" rowspan="3">序号</td>
<td width="6%" align="center" rowspan="3">医疗证号</td>
<td width="5%" align="center" rowspan="3">患者姓名</td>
<td width="4%" align="center" rowspan="3">性别</td>
<td width="4%" align="center" rowspan="3">年龄</td>
<td width="8%" align="center" rowspan="3">住址</td>
<td width="8%" align="center" rowspan="3">出院时间</td>
<td width="8%" align="center" rowspan="3">住院诊断</td>
<td width="8%" align="center" rowspan="3">诊疗机构</td>
<td width="4%" align="center" rowspan="3">住院天数</td>
<td width="6%" align="center" rowspan="3">上报时间</td>
<td width="16%" colspan="6">住院总费用(元)</td>
<td width="5%" rowspan="3">报销费用</td>
</tr>
<tr align=center style="height:20px;" >
<td width="6%" rowspan="2">合计</td>
<td width="15%" colspan="5">其中:</td>
</tr>
<tr align=center style="height:20px;" >
<td width="5%">药品费</td>
<td width="5%">检查费</td>
<td width="5%">治疗费</td>
<td width="5%">手术费</td>
<td width="5%">其它</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr align="center">
<td align="center">
<%# Container.ItemIndex + 1 %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem,"medical_card") %>
</td>
.
.
.
.
.
.
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
<!—表格结 束位置-à
</FooterTemplate>
</asp:Repeater>
效果如下页:
序号 | 医疗证号 | 患者姓名 | 性别 | 年龄 | 住址 | 出院时间 | 住院诊断 | 诊疗机构 | 住院天数 | 上报时间 | 住院总费用(元) | 报销费用 | |||||
合计 | 其中: | ||||||||||||||||
药品费 | 检查费 | 治疗费 | 手术费 | 其它 | |||||||||||||
1 | 46000119090123 | 易善明 | 男 | 46 | 冲山镇 冲山农场 红务村 | 2008-07-23 | 韦尼克 氏脑病(急性出血性脑灰质炎) | 海南省第二人民医院 | 1 | 0 - 0 | 567.00 | 123 | 0 | 0 | 0 | 444 | 810.00 |
2 | 46000701030010 | 王忠 | 男 | 33 | 畅好乡 草办村委会 育二 | 2008-07-23 |
| 五指山市毛阳卫生院 | 0 | 0 - 0 | 100.00 | 0 | 0 | 0 | 0 | 100 | 100.00 |
3 | 46000405040032 | 王忠海 | 男 | 46 | 毛阳镇 牙力村委会 牙力四 | 2008-07-23 | 维生素A缺乏合并结膜干燥病 | 海南省第二人民医院 | 5 | 0 - 0 | 400.00 | 200 | 0 | 200 | 0 | 0 | 900.00 |