前臺(tái)代碼:
復(fù)制代碼 代碼如下:
asp:Repeater ID="rptarry" runat="server" >
HeaderTemplate>table>/HeaderTemplate>
ItemTemplate>
tr>td> %# GetDataItem()%> /td>/tr>
/ItemTemplate>
FooterTemplate>/table>/FooterTemplate>
/asp:Repeater>
asp:Repeater ID="rptarryList" runat="server">
HeaderTemplate>table>/HeaderTemplate>
ItemTemplate>
tr>td> %# GetDataItem()%> /td>/tr>
/ItemTemplate>
FooterTemplate>/table>/FooterTemplate>
/asp:Repeater>
后臺(tái)代碼:
復(fù)制代碼 代碼如下:
public void bindrptarry()
{
string strs = "li|wen|yuan";
string[] str = strs.Split('|');
rptarry.DataSource =str;
rptarry.DataBind();
}
public void bindrptarryList()
{
string strs = "li|wen|yuan";
string[] str = strs.Split('|');
rptarry.DataSource = arrayList();
rptarry.DataBind();
}
public ArrayList arrayList()
{
ArrayList aL = new ArrayList();
aL.Add("liceshi");
aL.Add("wenceshi");
aL.Add("yuanceshi");
return aL;
}
在后臺(tái)用DataSource綁上數(shù)據(jù)源(數(shù)組或ArrayList)在調(diào)用DataBind()方法,
在前臺(tái)調(diào)用%# GetDataItem()%>。
如果哪里有不正確的地方,歡迎批評(píng)指正,共同進(jìn)步。
您可能感興趣的文章:- asp.net使用Repeater控件中的全選進(jìn)行批量操作實(shí)例
- ASP.NET中repeater控件用法實(shí)例
- 在Repeater控件中通過Eval的方式綁定Style樣式代碼
- Repeater控件與PagedDataSource結(jié)合實(shí)現(xiàn)分頁功能
- Repeater控件實(shí)現(xiàn)編輯、更新、刪除等操作示例代碼
- 給Repeater控件里添加序號(hào)的5種才常見方法介紹
- Repeater控件綁定的三種方式
- Repeater控件動(dòng)態(tài)變更列(Header,Item和Foot)信息實(shí)現(xiàn)思路
- 如何取得Repeater控件選擇的項(xiàng)目及注意事項(xiàng)
- Repeater控件數(shù)據(jù)導(dǎo)出Excel(附演示動(dòng)畫)
- 淺析Repeater控件的使用 (原樣導(dǎo)出和動(dòng)態(tài)顯示/隱藏Repeater中的列)