Repeater控制項使用

2021-09-06 08:10:30 字數 2063 閱讀 3773

對於repeater控制項,主要是注意headertemplate、itemtemplate、alternatingitemtemplate以及footertemplate的用法。

1、前台**
<%@ page language="c#" autoeventwireup="true" inherits="_default1" codebehind="default.aspx.cs" %>

<%@ import namespace="system.data" %>

序號                        類別名稱

管理操作

<%#((datarowview)container.dataitem)["productcategory_id"]%>'

type="hidden" />

<%#container.itemindex + 1%>

<%#((datarowview)container.dataitem)["productcategory_name"]%>

<%--                                <%#((datarowview)container.dataitem)["student_age"]%>

<%# databinder.eval(container.dataitem, "student_birth", "")%>

--%>

<%#((datarowview)container.dataitem)["productcategory_id"]%>'

title="修改資料">[修改資料]

<%#((datarowview)container.dataitem)["productcategory_id"]%>'

type="hidden" />

<%#container.itemindex + 1%>

<%#((datarowview)container.dataitem)["productcategory_name"]%>

<%--                                     <%#((datarowview)container.dataitem)["student_age"]%>

<%# databinder.eval(container.dataitem, "student_birth", "")%>

--%>

<%#((datarowview)container.dataitem)["productcategory_id"]%>'

title="修改資料">[修改資料]

新增2、後台**

using system;

using system.collections.generic;

using system.web;

using system.web.ui;

using system.web.ui.webcontrols;

using system.data.sqlclient;

using system.data;

using system.web.ui.htmlcontrols;

using system.data.common;

using system.text;

public partial class _default1 : system.web.ui.page

}private void binddata()

protected void aspnetpager1_pagechanged(object src, eventargs e)

protected void deletebtn_click(object sender, eventargs e)

binddata();

}private void deletestudent(string p)

#region 得到選種的checkbox的id,儲存到arraylist中

public listgetcheckboxids()

}return myarraylist;

}#endregion

}

使用Repeater控制項 2

在repeater控制項中加入 它的後台的 是 using system using system.data using system.configuration using system.collections using system.web using system.web.security ...

Repeater 控制項巢狀使用

概述 在專案中做許可權的時候使用到了repeater的巢狀 像for迴圈巢狀 如圖 這裡的功能頁面和功能許可權都是通過repeater遍歷出來的,表示的是乙個功能頁面中包含多個功能許可權,是個一對多的關係。具體的許可權設計這裡不說明,主要是說如何進行repeater巢狀的。具體步驟如下 第一步 定義...

Repeater控制項的使用

repeater控制項用於顯示重複的專案列表,這些專案被限制在該控制項中,不過這是一種自由的方式來控制資料 如何使用這個控制項,下面是我整理的一點理解 1.首先找到所繫結資料中重複的專案。例如下面這個table 這裡表的標題是不變的,變動的只是裡面的內容。所以我們就可以把repeater控制項放在前...