Repeater数据绑定控件的详细用法,举例说说
Repeater数据绑定控件的详细用法,举例说说
使用Repeater可以绘制表头、表内、表尾比较复杂的表格,如以下实例: <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate> <!—表格开始位置-224; <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> <!—表格结束位置-224; </FooterTemplate> </asp:Repeater>效果如下图