Repeater how to display delimiters at multiple lines of space

Source: Internet
Author: User
Repeater a method for displaying delimiters at multiple lines of space.

This example uses Vs.net (C #) to write the background. CS code. From admin10000.com

 protected void Page_Load (object sender, EventArgs e) {if (!                Page.IsPostBack) {Rptlist.datasource = GetTable ();            Rptlist.databind (); }} protected void Rptlist_itemdatabound (object sender, RepeaterItemEventArgs e) {if (E.I Tem. ItemType = = ListItemType.AlternatingItem | |                E.item.itemtype = = ListItemType.Item) {DataRowView DRV = (DataRowView) e.Item.DataItem;                Literal Ltltitle = (Literal) e.item.findcontrol ("Ltltitle"); Ltltitle.text = DRV. row["title"].                ToString (); if ((E.item.itemindex + 1)% 5 = = 0 && (e.item.itemindex + 1) <) {System.                    Web.UI.LiteralControl ul = new LiteralControl ("</ul><p class=\" sep\ "></p><ul>");                E.item.controls.add (UL); }}} DataTable GetTable () {DatatAble dt = new DataTable (); Dt.            Columns.Add ("title", typeof (String)); for (int i = 1; i <=; i++) {DataRow row = dt.                NewRow ();                row["title"] = "This is the article title" + i + ""; Dt.            Rows.Add (row);        } return DT; }

Front-desk. aspx code

<form id= "Form1" runat= "Server" >    <p>     <asp:repeater id= "rptlist" runat= "Server"             onitemdatabound= "Rptlist_itemdatabound" >            <HeaderTemplate>                <ul>            

Download code example: Pagedemo.rar

Related documents: pagination implementation of the Repeater control Repeater control implementation Edit, update, delete operations repeater nested using repeater

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.