<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的值,怎么弄?
<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的值,怎么弄?
这样简单多了啊
<table">
<th>
操作
</th>
</tr>
</HeaderTemplate>
中间对应 <td> <a href='<%#string.Format(".aspx?ID={0",Eval(HttpUtility.UrlEncode("ID")))%>'>获取ID</a>
之后可以把ID传入你想要的哪个页面上。之后在页面上获取IDOK了
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;
中通过
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;
}
e.Item.Attributes.Add("onclick","window.alert('"+v.Row["article_ID"].ToString()+"')");
<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找那条