Reprinted: http://www.cnblogs.com/thcjp/archive/2006/07/20/455489.html
I have posted
Http://thcjp.cnblogs.com/archive/2006/07/08/446076.html
The original author's words should be taken as an example
(The following code is a waste of at least four hours to come up with. In fact, the main problem is that I made a mistake in the page execution sequence, which would take so long, depressed !)
1 protected void Page_Load (object sender, EventArgs e)
2 {
3 Repeater rp = (Repeater) Page. Master. FindControl ("Repeater1"); // It is the first step to figure out the Repeater control.
4 rp. DataSource = dhdat; // if you want to bind the previous page, the number of items cannot be found below,
5 rp. DataBind (); // so it is important here
6
7 int coun = rp. Items. Count; // obtain the number of Repeater Items
8 for (int I = 0; I <coun; I ++) // loop all items
9 {
10 hyperlink diqu = (Hyperlink) RP. items [I]. findcontrol ("hyperlink1 ");
11 // find the hyperlink1 control, which is the word for navigation.
12 string aid = (Label) RP. items [I]. findcontrol ("label1"). Text. tostring ();
13 // because the repeater does not have a primary key, at least I don't know, so I will put another label to store the ID.
14 string url = "list. aspx? Aid = "+ aid + "";
15 // because the URL has multiple conditions, the URL is constructed here
16 if (Request. QueryString ["aid"] = null)
17 {
18 diqu. NavigateUrl = url;
19}
20 //. The specific judgments are boring.
21}
22
23
24
25}
26