我有 Telerik radgrid 与网格模板列绑定,删除图标的可见性是通过调用方法 ISDeleteVisible 背后的代码来决定的错误。
<telerik:GridTemplateColumn AllowFiltering="false" UniqueName="Options">
<ItemTemplate>
<asp:ImageButton ID="imgDelete" runat="server" CommandName="cmdDelete" ToolTip="Delete"
Visible="<%# ISDeleteVisible(Eval("AgencyType") %>" CommandArgument="Container.DataItemIndex"
CausesValidation="False" ImageUrl="<%$ Resources:WebResource, deleteIcon %>"
OnClientClick="javascript:return confirm('Are you sure you want to delete?');" />
</ItemTemplate>
<ItemStyle Width="100px" />
</telerik:GridTemplateColumn>
在后面的代码中,我的代码后面的方法为
protected bool ISDeleteVisible(string AgencyType)
{
if(AgencyType=="HouseHoldAgency")
ISDELETE = true;
else
ISDELETE = false;
return ISDELETE;
}