{
Repeater rp = (Repeater)Page.Master.FindControl( " Repeater1 " ); // 找出Repeater控件出来是第一步
rp.DataSource = dhdat; // 如果是让前面页他自己绑定的话,下面就读不出来项数了,
rp.DataBind(); // 所以这里是很重要的
int coun = rp.Items.Count; // 得到Repeater的项数
for ( int i = 0 ; i < coun; i ++ ) // 循环所有项
{
HyperLink diqu = (HyperLink)rp.Items[i].FindControl( " HyperLink1 " );
// 找到HyperLink1这个控件,也就是我们要做导航的字
string aid = ((Label)rp.Items[i].FindControl( " Label1 " )).Text.ToString() ;
// 因为Repeater没有主键,至少我不知道,所以就多放一个Label存放ID,这里再出来
string url = " list.aspx?aid= " + aid + "" ;
// 因为这个URL会有多个条件,所以在这里构造URL
if (Request.QueryString[ " aid " ] == null )
{
diqu.NavigateUrl = url;
}
//

}
}