如何使用嵌套repeater-創(chuàng)新互聯(lián)

本篇內(nèi)容主要講解“如何使用嵌套repeater”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“如何使用嵌套repeater”吧!

我們提供的服務(wù)有:成都做網(wǎng)站、成都網(wǎng)站建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、彭山ssl等。為近1000家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的彭山網(wǎng)站制作公司

前臺(tái)代碼部分:

復(fù)制代碼 代碼如下:

<asp:repeater runat="server" id="repeater1" OnItemDataBound="function2">

<itemtemplate>

<asp:repeater runat="server" id="repeater2">

<itemtemplate>

</itemtemplate>

</asp:repeater>

<itemtemplate>

</asp:repeater>


后臺(tái)代碼部分:


復(fù)制代碼 代碼如下:

private void function1()
{
repeater1.datasource = datatable;
repeater1.databind();
}

private void function2(object sender,repeateritemeventargs e)

{

//判斷里層repeater處于外層repeater的哪個(gè)位置(alternatingitemtemplate,footertemplate,headertemplate,itemtemplate,separatortemplate)

if(e.item.itemtype == listitemtype.item || e.item.itemtype == listitemtype.alternatingitem)

{

repeater rpt = e.item.findcotrol("repeater2") as repeater;  //找到里層的repeater對(duì)象

datarowview row = (datarowview)e.item.dataitem;      //找到分類repeater關(guān)聯(lián)的數(shù)據(jù)項(xiàng)

int typeid = convert.toint32(row["id"]);            //獲取填充子類的id

rpt.datasource = datatable;

rpt.databind();

}
}


到此,相信大家對(duì)“如何使用嵌套repeater”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)建站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

網(wǎng)站名稱:如何使用嵌套repeater-創(chuàng)新互聯(lián)
文章路徑:http://bm7419.com/article36/didppg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站網(wǎng)站排名、App設(shè)計(jì)、網(wǎng)站制作搜索引擎優(yōu)化、全網(wǎng)營(yíng)銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)