GridView 与自定义对象的绑定和分页
2008-03-04 15:44
447 查看
一、自定义对象和对象集合
using System;
using System.Collections;
using System.Collections.Generic;
public class Bus
public class BusCollection
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1"
runat="server"
AutoGenerateColumns="False"
CssClass="class2"
EnableViewState="False"
AllowPaging="true"
OnPageIndexChanging="GridView1_PageIndexChanging">
<Columns>
<asp:BoundField DataField="Name" HeaderText="手机号码" />
<asp:BoundField DataField="Longitude" DataFormatString="{0:0.00000}" HeaderText="经度" />
<asp:BoundField DataField="Latitude" DataFormatString="{0:0.00000}" HeaderText="纬度" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
后台代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
样式表StyleSheet.css
*
.class2
.class2 td
.class2 th
using System;
using System.Collections;
using System.Collections.Generic;
public class Bus
public class BusCollection
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1"
runat="server"
AutoGenerateColumns="False"
CssClass="class2"
EnableViewState="False"
AllowPaging="true"
OnPageIndexChanging="GridView1_PageIndexChanging">
<Columns>
<asp:BoundField DataField="Name" HeaderText="手机号码" />
<asp:BoundField DataField="Longitude" DataFormatString="{0:0.00000}" HeaderText="经度" />
<asp:BoundField DataField="Latitude" DataFormatString="{0:0.00000}" HeaderText="纬度" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
后台代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
样式表StyleSheet.css
*
.class2
.class2 td
.class2 th
相关文章推荐
- 复杂自定义数据对象绑定到GridView的问题
- 动态绑定GridView并自定义分页
- 自定义GridView分页排序功能的结构整理
- VS2005 GridView动态绑定数据源(交叉表) 动态绑定列 动态生成模板列 自定义表头
- SSRS用自定义对象绑定报表
- 关于VS2005中GridView的自定义分页,单选、多选、排序、自增列的简单应用
- GridView控件自定义分页详解
- GridView控件自定义分页详解
- ASP.NET中GridView的自定义分页
- Asp.Net:GridView 编辑、删除、自定义分页以后备用
- ASPxGridView动态绑定数据源时排序,分组,分页等功能失效的解决办法
- GridView实战一:自定义分页、排序、修改、插入、删除
- GridView 批量删除,自定义分页,定位页码
- 关于GridView中自定义分页、单选、多选、排序、自增列的简单应用
- GridView自定义分页样式(上一页,下一页,到第几页)
- GridView中的自定义绑定
- GridView自定义分页控件
- GridView控件的绑定分页功能
- GridView自定义分页样式(上一页,下一页,到第几页)(新手教程)
- 扩展GridView控件(10) - 自定义分页样式