<asp:repeater OnItemDataBound="Repeater_RowDataBound " id="news" Runat="server">
<ItemTemplate>
<tr bgcolor="#E6F4D4" align="center" onMouseOut="this.bgColor='#E6F4D4'" onMouseOver="this.bgColor='#b1db99'">
<td style="word-break:break-all"><%# DataBinder.Eval(Container.DataItem,"lcywbh") %></td>
<a href ='<%# DataBinder.Eval(Container.DataItem,"url5")%>?lcywbh=<%# DataBinder.Eval(Container.DataItem,"lcywbh")%>'>
详情</a>
</td>
<td>
<asp:LinkButton ID="btnDelete " CssClass="blueFont" CommandArgument=<%#DataBinder.Eval(Container.DataItem,"lcywbh")%> OnCommand= "btnDelete_Command" runat="server">删除</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:repeater>
后台代码 :
protected void Repeater_RowDataBound (object sender, RepeaterItemEventArgs e)
{
//如果是绑定数据行
((LinkButton)e.Item.FindControl("btnDelete ")).Attributes.Add("onclick", "javascript:return confirm('你确认要删除吗?')");
}