Repeater how to implement multiple-line interval display separator

Source: Internet
Author: User

  This article is about how to implement the repeater to display the separator, here is a good example, interested friends can refer to the following

  Code as follows: 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.item.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 (" ");  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}    <</code>form id= "Form1" runat= "Server" >  < </CODE>div>  <</code>asp:repeater id= "rptlist" runat= "server"   onitemdatabound= " Rptlist_itemdatabound ">  <</CODE>HeaderTemplate>  <</CODE>ul>  </ </CODE>HeaderTemplate>  <</CODE>ItemTemplate>  <</CODE>li>  < </code>asp:literal id= "Ltltitle" runat= "Server" ></</code>asp:literal></</code>li >  </</CODE>ItemTemplate>  <</CODE>FooterTemplate>  </</CODE> ul></</code>footertemplate>  </</CODE>asp:Repea</</CODE>form>   

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.