Repeater level Three nested bindings

Source: Internet
Author: User

<asp:repeater id= "RPT1" runat= "Server" onitemdatabound= "Rpt1_itemdatabound" >          <HeaderTemplate> <table width=400 cellpadding=0 cellspacing=0>

backstage. Aspx.cs

    protected void Rpt1_itemdatabound (object sender, RepeaterItemEventArgs e)     {         if (E.item.itemtype = = ListItemType.Item | | e.item.itemtype = = ListItemType.AlternatingItem)         {             Repeater rpt2 = (Repeater) e.item.findcontrol ("Rpt2");            //Find the data items associated with the taxonomy repeater              DataRowView ROWV = (DataRowView) e.Item.DataItem;             Rpt2. ItemDataBound + = new Repeateritemeventhandler (rpt2_itemdatabound); The most important sentence            //extract category ID              cid = Convert.ToInt32 (rowv["ID"]);            //Search for products under this category by Category ID and bind products repeater             Rpt2. DataSource = PCATEGORY.GETP (CID);//Data binding             RPT2. DataBind ();        }    }     protected void rpt2_ ItemDataBound (object sender, RepeaterItemEventArgs e)     {         if (E.item.itemtype = = ListItemType.Item | | e.item.itemtype = listitemtype.alternatingitem)    & nbsp;    {            Repeater RPT3 = ( Repeater) E.item.findcontrol ("Rpt3");            //Find the data items associated with the taxonomy repeater              DataRowView rowvv = (DataRowView) e.Item.DataItem;            //ExtractionCategory ID             cid2 = Convert.ToInt32 (rowvv["ID"]);            //Search for products under this category by Category ID and bind products repeater              RPT3. DataSource = GETRPT3 (CID, CID2);//Data binding             RPT3. DataBind ();        }    }

Reprinted from: http://www.aspnetjia.com

Repeater level Three nested bindings

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.