Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 21st, 2007, 08:31 PM
Authorized User
Join Date: Jun 2006
Location: , , Malaysia.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to allow paging in datalist?

Do you know how to allow paging in datalist?

I get some source code on the internet, but they didnt mention how to connect to the database, the code just show to connect to the fix data( red color part). I need to connect to my database(enterprise) and table(Contents), so anyone can help me?

Example source code get from other website:

<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(byVal obj As Object, byVal e As EventArgs)
End Sub

Sub doPaging()
     Dim mockData As New HashTable()
  Dim IDx As Integer = 0
  Do Until IDx = 500
     mockData.Add(IDx.toString(), (IDx * 101).toString)
     IDx += 1

  Dim pagedData As New PagedDataSource()
  pagedData.DataSource = mockData
  pagedData.AllowPaging = True
  pagedData.PageSize = 5

  theDataList.DataSource = pagedData
End Sub

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     <title>Paging Example 1</title>

     <asp:DataList id="theDataList" runat="server">

           Department: <%# DataBinder.Eval(Container.DataItem,
           "Key") %><br />
           Employee ID: <%# DataBinder.Eval(Container.DataItem,
           "Value") %></a><br />

Reply With Quote
  #2 (permalink)  
Old January 21st, 2007, 10:08 PM
Authorized User
Join Date: Jun 2006
Location: , , Malaysia.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

just solve the problem..:)

the solution below here :

Dim args As DataSourceSelectArguments = New DataSourceSelectArguments()
Dim view As DataView = CType(SqlDataSource1.Select(args), DataView)
Dim table As DataTable = view.ToTable()
pagedData.DataSource = Table.DefaultView
pagedData.AllowPaging = True
pagedData.PageSize = 5

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Datalist with paging venkatu2005 ASP.NET 1.0 and 1.1 Professional 1 July 17th, 2008 01:10 AM
paging datalist shanwaj ASP.NET 2.0 Basics 1 March 25th, 2008 12:03 AM
Datalist Paging webnathan ASP.NET 1.0 and 1.1 Basics 3 November 19th, 2007 11:11 AM
Datalist Paging nedo_786 ASP.NET 2.0 Professional 9 September 20th, 2007 04:32 AM
Datalist Paging in C# caitydev ASP.NET 2.0 Basics 0 March 29th, 2006 06:53 AM

All times are GMT -4. The time now is 11:46 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.