如题

解决方案 »

  1.   

    GridView,DataList,Repeater,DetailsView的遍历行代码
      

  2.   


    for(int i =0;int i<repeater1.row.Count i++)
    {
         reperter1.Count[i]....
    }手敲的   可能有点失误  不过你自己好好看下应该能解决
      

  3.   

    没办法和gridview那样遍历,要看你repeater里面具体是如何绑定的.
      

  4.   

      这个好像是不行吧
            只有看你里面杂绑定的了!
    也可以在它里面套一个gridview
      

  5.   

    for(int i =0;int i<repeater1.row.Count i++)
    {
         reperter1.Count[i]....
    }
      

  6.   

            for (int i = 0; i < this.Reapter1.Items.Count; i++)
            {
                //CheckBox cb = this.rpLink.Items[i].FindControl("cbChild") as CheckBox;
                //HiddenField hf = this.rpLink.Items[i].FindControl("hf") as HiddenField;
                //if (cb != null && cb.Checked && hf != null)
                //{
                   // modifyInfo(Convert.ToInt32(hf.Value));            //}
            }
      

  7.   


     RepeaterItemCollection rtc =  this.Repeater1.Items;
                foreach(RepeaterItem item in rtc)
                {
                }这样遍历吧
      

  8.   

    <a href="www.baidu.com"></a>
      

  9.   

    foreach(RepeaterItem items in repeater1.Items){}
    or
    for(int i=0;i<Repeater1.ItemsCount-1;i++){}
      

  10.   

    this.NewGameRoom.DataSource = GameRooms;
                    this.NewGameRoom.ItemDataBound += new RepeaterItemEventHandler(NewGameRoom_ItemDataBound);
                    this.NewGameRoom.DataBind();
    这是绑定语句撒,里面不是有个this.NewGameRoom.ItemDataBound += new RepeaterItemEventHandler(NewGameRoom_ItemDataBound);
    这一句就是用来遍历的,如果只要数据绑定行
    void NewGameRoom_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
                {
                    KeyValuePair<ushort, string> key = (KeyValuePair<ushort, string>)e.Item.DataItem;
                    Literal nickname = e.Item.FindControl("nickname") as Literal;
                    Literal small_blind = e.Item.FindControl("small_blind") as Literal;
                    Literal big_blind = e.Item.FindControl("big_blind") as Literal;
                    Literal user_count = e.Item.FindControl("user_count") as Literal;
                    Literal user_max = e.Item.FindControl("user_max") as Literal;                nickname.Text = roomdic[key.Key]["nickname"];
                    small_blind.Text = roomdic[key.Key]["small_blind"];
                    big_blind.Text = roomdic[key.Key]["big_blind"];
                    user_count.Text = roomdic[key.Key]["user_count"];
                    user_max.Text = roomdic[key.Key]["user_max"];                HyperLink intoGame = e.Item.FindControl("intoGame") as HyperLink;
                    if (GlobalVariable.GameLimite() == 1)
                    {
                        intoGame.Attributes.Add("onclick", string.Format("javascript:PlayGame('{0}',Right.IsGame('{1}',{2}),'{3}');", key.Key.ToString().DESEncrypt(), _User.GetUserTicket().UID.ToString(), 1, key.Key.ToString()));
                    }
                    else
                    {
                        intoGame.Attributes.Add("onclick", string.Format("javascript:PlayGame('{0}',Right.IsRoom('{1}',{2}),'{3}');", key.Key.ToString().DESEncrypt(), _User.GetUserTicket().UID.ToString(), key.Key.ToString(), key.Key.ToString()));
                    }
                }
            }
    最开始的这句
    if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)就是用来判断是那种类型的行,有header,foot,如果不要这句,就是遍历所有的行
      

  11.   


    foreach(RepeaterItem item in Rp1.Items)
    {}
      

  12.   

    if (this.rptTypes.Items.Count != null && this.rptTypes.Items.Count > 0)
                {
                    foreach (RepeaterItem item in this.rptTypes.Items)
                    {
                        
                        Common.ProcessWrite.WriteDialog(item.Index.ToString());
                    }
                }