"ASP" What! There's a repeater?! inside repeater.

Source: Internet
Author: User

I will stick to the core code, this project because I am helping others to do, so temporarily can not open too much source code

(If you really want to source code, and so I help him at the end of October to promote the project to three floor, then open the current 1.0 version of the source Bar ~)

First of all, my purpose: according to the ID in Repeter1, nested query Repeter internal values (no way, my database is designed with three layers, so the code is ... )

Directly paste the core source code (in fact, the number of more than the interference line of sight)
  1. Repeater1 Register Repeater1_itemdatabound Event  <asp:repeater id= "Repeater1"  runat= " Server "  onitemdatabound=" Repeater1_itemdatabound "> <ItemTemplate>     .............        <asp:textbox id= "Tbl_SayId"   runat= "Server"  text= ' <% #Eval ("Tbl_sayid")  %> '  visible= ' False ' ></asp:TextBox>     ..............        <asp:repeater id = "Repeater2"  runat= "Server" >        <ItemTemplate>         ...............        </ itemtemplate>        <alternatingitemtemplate>         ...............        </ Alternatingitemtemplate>&nBsp;       </asp:repeater>    </itemtemplate > </asp:Repeater> 
Want a purpose? TextBox, what am I doing here? ~ Think of ... ~ ~ ~ (hidden, for the back or value)

If the direct access in the background is not Repeater2, must be accessed indirectly through Repeater1, and the method of configuration ObjectDataSource not work (my control is not very familiar with), so for Repeater2 I personal overdraft knock code, Here's a look at the backend code:
protected void Repeater1_itemdatabound (object sender, RepeaterItemEventArgs e) {Repeater r2 = (Repeater) e.item. FindControl ("Repeater2"); Get to Repeater2 TextBox txtID = (textbox) E.item.findcontrol ("Tbl_sayid"); Get the value you need for the DataTable dt = Say.getresays (txtID. Text); Query based on your values and return the results (say is a temporary tool Class I defined) R2. DataSource = DT; Develop the REPEATER2 data source R2. DataBind (); It's a bit of a waste of time if you don't really want to. Offer a sister, relax under the mood ~ hahaha, Flash ~



The school speed is too rubbish ... I want to be in the daytime.

"ASP" What! There's a repeater?! inside repeater.

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.