循环遍历泛型集合List绑定到table
<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeFile="Default4.aspx.cs" Inherits="Default4" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<style>
table { background:#D3E4E5;
border:1px solid gray;
border-collapse:collapse;
color:#fff;
font:normal 12px verdana, arial, helvetica, sans-serif;
}
caption { border:1px solid #5C443A;
color:#5C443A;
font-weight:bold;
letter-spacing:20px;
padding:6px 4px 8px 0px;
text-align:center;
text-transform:uppercase;
}
td, th { color:#;
padding:.4em;
}
tr { border:1px dotted gray;
}
thead th, tfoot th { background:#5C443A;
color:#FFFFFF;
padding:3px 10px 3px 10px;
text-align:left;
text-transform:uppercase;
}
tbody td a { color:#;
text-decoration:none;
}
tbody td a:visited { color:gray;
text-decoration:line-through;
}
tbody td a:hover { text-decoration:underline;
}
tbody th a { color:#;
font-weight:normal;
text-decoration:none;
}
tbody th a:hover { color:#;
}
tbody td+td+td+td a
{
background-position:left center;
background-repeat:no-repeat;
color:#03476F;
padding-left:15px;
}
tbody td+td+td+td a:visited
{
background-position:left center;
background-repeat:no-repeat;
}
tbody th, tbody td { text-align:left;
vertical-align:top;
}
tfoot td { background:#5C443A;
color:#FFFFFF;
padding-top:3px;
}
.odd { background:#fff;
}
tbody tr:hover { background:#99BCBF;
border:1px solid #03476F;
color:#;
}</style>
<body>
<form id="form1" runat="server">
<div>
<table cellpadding="" cellspacing="">
<thead>
<tr class="odd">
<th style="width:40px"> 编号</th>
<th style="width:40px">
性别</th>
<th style="width:40px">
姓名</th>
<th style="width:40px">
名族</th>
<th style="width:40px">
日期</th>
<th style="width:40px">
其他</th>
<th style="width:40px">
</th>
<th style="width:40px">
</th>
<th style="width:40px">
</th>
</tr>
</thead> <% int Count=party.Count(); for (int i = ; i < Count; i++)
{
if (i % == )
{
%> <tr class="odd">
<td><%=party[i].Jmsfzh%></td>
<td><% =party[i].Xm %></td>
<td><% =party[i].Xb %></td>
<td><% =party[i].Mz %></td>
<td><% =party[i].Csrq %></td>
<td><% =party[i].Szdzb %></td>
<td>增加</td>
<td>修改</td>
<td>删除</td> </tr> <%}
else
{
%> <tr>
<td><%=party[i].Jmsfzh%></td>
<td><% =party[i].Xm %></td>
<td><% =party[i].Xb %></td>
<td><% =party[i].Mz %></td>
<td><% =party[i].Csrq %></td>
<td><% =party[i].Szdzb %></td>
<td>增加</td>
<td>修改</td>
<td>删除</td> </tr> <%
} } %>
</table> <%-- <asp:GridView ID="grv" runat="server">
</asp:GridView>--%>
</div>
</form>
</body>
</html>
循环遍历泛型集合List绑定到table的更多相关文章
- 迭代器、foreach循环、泛型集合
集合的迭代 语法:Iterator<Object> it=集合.iterator(); while(it.hasNext()){ Object obj=it.next(); } is.ha ...
- C# 遍历泛型集合
/// <summary> /// 遍历泛型 /// </summary> /// <typeparam name="T"></typep ...
- JSP页面通过c:forEach标签循环遍历List集合
c:forEach>标签有如下属性: 属性 描述 是否必要 默认值items 要被循环的信息 否 无begin 开始的元素(0=第一个元素,1=第二个元素) 否 0end 最后一个元素(0=第一 ...
- Java:集合for高级循环遍历
增强for循环: 格式:for(变量数据类型 要遍历的变量 :元素所在数组(集合)名称) 也即 for(Type element: array或collection) 使用foreach遍历集合: 只 ...
- for循环和foreach循环遍历集合的效率比较
先上代码 package com.test; import java.util.ArrayList; import java.util.LinkedList; import java.util.Lis ...
- 遍历List集合,删除符合条件的元素
List集合的遍历有三种方式:增强for循环,普通for循环,Iterator迭代器遍历 如果只是对集合进行遍历,以上三种循环都可正常遍历: (1)增强For循环遍历List集合 List<St ...
- 将java类的泛型集合转换成json对象
一般用extjs开发传输都是用json比较多,这个将来大家也许会用到... ConvertJsonUtils.java package com.sunweb.util.jsonfactory; imp ...
- 编写高质量代码改善C#程序的157个建议[动态数组、循环遍历、对象集合初始化]
前言 软件开发过程中,不可避免会用到集合,C#中的集合表现为数组和若干集合类.不管是数组还是集合类,它们都有各自的优缺点.如何使用好集合是我们在开发过程中必须掌握的技巧.不要小看这些技巧,一旦在开 ...
- 18_集合框架_第18天_集合、Iterator迭代器、增强for循环 、泛型_讲义
今日内容介绍 1.集合 2.Iterator迭代器 3.增强for循环 4.泛型 01集合使用的回顾 *A:集合使用的回顾 *a.ArrayList集合存储5个int类型元素 public stati ...
随机推荐
- curl命令 抓取网络数据相应头
curl --verbose --data "Password=123&Username=158101068&url=http://m.vancl.com/" & ...
- iOS计算字符串的宽度高度
OC开发中会遇到根据字符串和字体大小来算计算出字符串所占的宽高->> 封装方法如下: #import <Foundation/Foundation.h> #import < ...
- mongoose学习笔记1--基础知识1
今天我们将学习Mongoose,什么是Mongoose呢,它于MongoDB又是什么关系呢,它可以用来做什么呢? MongoDB是一个开源的NoSQL数据库,相比MySQL那样的关系型数据库,它更显得 ...
- 解决eclipse manven项目添加不了maven dependencis
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"& ...
- chaper3_exerise_Uva1368_DNA序列
#include<iostream> #include<stdio.h> #include<cmath> #include<string> #inclu ...
- StoryBoard和代码结合 按比例快速兼容iPhone6/6 Plus教程
转:http://www.cocoachina.com/ios/20141230/10800.html 编者注:根据网友们的评论,文章中的方法有很大的局限性,请谨慎使用! 现在由于苹果公司出了6和6 ...
- iOS,Objective-C,相册功能的实现。
#import "ViewController.h" #define kuan [UIScreen mainScreen].bounds.size.width #define ga ...
- Java -- String、StringBuffer、StringBuilder
原文:http://blog.csdn.net/kingzone_2008/article/details/9220691 String:不可变. StringBuffer(JDK1.0):可变,线程 ...
- ListView介绍
原文:http://blog.csdn.net/qingye_love/article/details/13772391?utm_source=tuicool&utm_medium=refer ...
- C#的正则表达式
using System; using System.Collections; using System.Collections.Generic; using System.IO; using Sys ...