5月 27, 2010

DataList 分頁法


Protected Sub DataList1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.PreRender
        Dim dv As DataView = sds_add.Select(DataSourceSelectArguments.Empty)
        'datalist 分頁法
        Dim a As New PagedDataSource
        a.DataSource = dv
        a.AllowPaging = True
        a.PageSize = 5
        a.CurrentPageIndex = h1.Value
        DataList1.DataSource = a
        DataList1.DataBind()
        'Response.Write(DataList1.Items.Count)
    End Sub

沒有留言: