<asp:Repeater runat="server" ID="repnewlsit" OnItemCommand="itemCommand" OnItemDataBound="repnewlsit_ItemDataBound">
<ItemTemplate>
<asp:LinkButton ID="btnDisable" runat="server" CssClass='btn btn-sm btn-icon btn-danger' title="删除"
CommandName="btnDisable" CommandArgument='<%# Eval("newsid")%>' OnClientClick="return confirm('删除的案例无法恢复,确定删除吗?');"
><i class="glyphicon glyphicon-trash"></i></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
cs:
protected void itemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "btnDisable" )
{
int ID = int.Parse(e.CommandArgument.ToString());
}
}
//限制按钮显示
protected void repnewlsit_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
System.Data.DataRowView dr = (System.Data.DataRowView)e.Item.DataItem;
LinkButton btnDisable = (LinkButton)e.Item.FindControl("btnDisable");
LinkButton btnNoDisable = (LinkButton)e.Item.FindControl("btnNoDisable");
if (dr["lzf"].ToString().Trim() == "1")
{ btnDisable.Visible = true;
btnNoDisable.Visible = false;
}
else
{
btnDisable.Visible = false;
btnNoDisable.Visible = true;
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。