Nested repeater: How do nested repeater columns reference external repeater columns?

Source: Internet
Author: User
Nested repeater: How do nested repeater columns reference external repeater columns?

 

That is to say, I want to reference the value of an external repeater column in the repeater itemtemplete.
<! -- Start parent repeater -->
<Asp: repeater id = "parent" runat = "server">
<Itemtemplate>
<B> <% # databinder. eval (container. dataitem, "au_id") %> </B> <br>

<! -- Start child repeater -->
<Asp: repeater id = "child" datasource = "<% # (datarowview) container. dataitem)
. Row. getchildrows ("myrelation") %> "runat =" server ">
<Itemtemplate>
<% # Databinder. eval (container. dataitem, "[\" title_id \ "]") %> <br>
<% # Databinder. eval (container. dataitem, "au_id") %> ************************
</Itemtemplate>
</ASP: repeater>
<! -- End Child repeater -->
</Itemtemplate>
</ASP: repeater>
<! -- End parent repeater -->

How to Implement the effect of the top-side ** * ** line? If you follow the preceding method, an error will occur.

Step 1:
Declare a variable in the background code of the page:
Protected object parentdataitem; // note that the object is protected.

Step 2:
Then process the itemdatabound event of the parent control:
Private void parent_itemdatabound (Object sender, system. Web. UI. webcontrols. repeateritemeventargs E)
{
Parentdataitem = E. Item. dataitem;
}

Step 3:
Set
<% # Databinder. eval (container. dataitem, "au_id") %> ************************
Changed:
<% # Databinder. eval (parentdataitem, "au_id") %> ************************

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.