<asp:Repeater ID="RepArticleList" runat="server" onitemcommand="RepArticleList_ItemCommand" >
            
            <ItemTemplate>
            
            <tr>
            <td valign=middle align=center width="6%" height="22" background="Images/newsbg.gif"><span class="STYLE15"><%# DataBinder.Eval(Container.DataItem,"article_ID") %></span></td>
            
 
          </tr>
            </ItemTemplate>
            
            </asp:Repeater>
比如我选中了其中一行,想获得这行article_ID的值,怎么弄?

解决方案 »

  1.   

    repeater里不能获取列,所有你只能通过把值赋给控件,再到后台获取控件获取值
      

  2.   

    用个 隐藏的 textbox 不可以么
    这样简单多了啊
      

  3.   

           头部加个     <HeaderTemplate>
                    <table">
                             <th>
                            操作
                        </th>
                        </tr>
                </HeaderTemplate>
    中间对应               <td> <a href='<%#string.Format(".aspx?ID={0",Eval(HttpUtility.UrlEncode("ID")))%>'>获取ID</a>
    之后可以把ID传入你想要的哪个页面上。之后在页面上获取IDOK了
      

  4.   


      protected void rpOtherLeaderStat_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {            for (int iss = 0; iss < rpOtherLeaderStat.Items.Count; iss++)
                {
                    Label lblName = rpOtherLeaderStat.Items[iss].FindControl("lblName") as Label;
                 }
    }你在外面获取
    Label lblName = rpOtherLeaderStat.Items[行号].FindControl("lblName") as Label;
      

  5.   

    <span class="STYLE15"><%# DataBinder.Eval(Container.DataItem,"article_ID") %></span>改为 <asp:Lable ID="lbArticleID" runat="server" CssClass="STYLE15" Text='<%# DataBinder.Eval(Container.DataItem,"article_ID") %>'></asp:Lable>后台Repeater的 ItemDataBound 或 ItemCommand
    中通过
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem)
            {
                Lable  lbArticleID= e.Item.FindControl("lbArticleID") as Lable;            string articleID=lbArticleID.Text;
            }
      

  6.   

    DataBound事件DataRowView v = e.Item.DataItem as DataRowView;
    e.Item.Attributes.Add("onclick","window.alert('"+v.Row["article_ID"].ToString()+"')");
      

  7.   

    你在<asp:Repeater ID="RepArticleList" runat="server" onitemcommand="RepArticleList_ItemCommand" >
        
      <ItemTemplate>
        
      <tr>
      <td valign=middle align=center width="6%" height="22" background="Images/newsbg.gif"><span class="STYLE15"><%# DataBinder.Eval(Container.DataItem,"article_ID") %></span>
    <lable id = "LABone" runat="server" Visible = "false"  Text='<% #Bind("ID") %>'>
    </td>
        
     
      </tr>
      </ItemTemplate>
        
      </asp:Repeater>通过ID找那条