标签:data control argument .com disable rgs css button else
<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;
}
}
标签:data control argument .com disable rgs css button else
原文地址:http://blog.51cto.com/zhaoyingyatou/2139377