页面代码如下:
<asp:ListView runat="server" ID="_simpleTableListView">
  <LayoutTemplate>
    <table>
      <thead>
        <tr>
             <th ;
   OleDbDataAdapter dp=new OleDbDataAdapter(sql,conn);
   DataTable dt = new DataTable();
   dp.Fill(dt);
   _simpleTableListView.DataSource = dt;
   _simpleTableListView.DataBind();
  }
    }
注意:使用本方法,不需要在页面的Page_Load事件中绑定数据到ListView控件,
否则分页会有问题。

第2种方法:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindData();
        }
    }
 protected void _simpleTableListView_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
    {
        DataPager2.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
        BindData();
    }

相关文章: