<td>
<asp:Button ID="Button1" runat="server" Text="查看" OnClientClick="return confirm('确定要查看吗?');" CommandName="del" CommandArgument='<%#Eval("Telephone")%>' CssClass="btn btn-primary" />
<asp:Label ID="lab" runat="server" Text="" ></asp:Label>
</td>
实现功能,点击ItemTemplate按钮把键值带过去,隐藏按钮让lable显示出相应的文字!
Repeater1.ItemCommand += Repeater1_ItemCommand;//查看
void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "del")
{
((Button)e.Item.FindControl("Button1")).Visible = false;
string id = e.CommandArgument.ToString();
((Label)e.Item.FindControl("lab")).Text = id;
}
}