Asp. NET program with repeater implementation paging

Source: Internet
Author: User
Tags eval first row
First, the procedure function: realizes the paging for the repeater
Second, form design:
1. New asp.net Web application, named Repeater2, save path for Http://192.168.0.1/Repeater2 (note: The IP of the website on my machine is 192.168.0.1 's home directory is D:web folder) then click OK.
2. Add a 3-row table to the form, add a repeater control to the first row of the table, add two label controls to the second row of the table, and add four button buttons to the third row of the table.
3. Switch to the HTML code window and add the following code between <asp:repeater id= "Repeater1" runat= "Server" and "</asp:Repeater>":
<ItemTemplate>
<table id= "Table2" style= "Font-size:x-small" width= "498"
<tr>
<td> <% #DataBinder. Eval (Container, "Dataitem.employeeid")%> </td>
<td> <% #DataBinder. Eval (Container, "Dataitem.lastname")%> </td>
</tr>
</table>
</ItemTemplate>
Third, code design:
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
Dim Scon as New SqlConnection ("server=localhost;database=northwind;uid=sa;pwd=123")
Dim SDA as SqlDataAdapter
Dim DS as DataSet
Dim currentpage as Integer ' records which page is currently on
Dim Maxpage as Integer ' total number of pages
Const RowCount as Integer = 3 ' page How many rows
Dim rowsum as Integer ' total number of rows
' Form code omitted
Private Sub Page_Load (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles MyBase.Load
If not Page.IsPostBack Then
SDA = New SqlDataAdapter ("SELECT EmployeeID, LastName FROM Employees ORDER by EmployeeID", Scon)
ds = New DataSet
Try
Sda.fill (ds, "Employees")
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.