So I have this gridview, inside the gridview I have this template field, and inside this template fied I have this button. Which all works really well. However I would like to disable the button if the value of another column is something specific, please observe:
<asp:GridView ID="grv_regionManagement" runat="server">
<Columns>
<asp:TemplateField HeaderText="Commands" ShowHeader="false">
<ItemTemplate>
<asp:Button Text="Edit" CommandName="Edit" CausesValidation="false" runat="server"
ID="btEdit" Enabled='<%# Eval("regionName") != "Disabled" %>' />
</ItemTemplate>
</Columns>
</asp:GridView>
Notice the evaluation: Enabled='<%# Eval(“regionName”) != “Disabled” %>’ , however this does not work and the button is always enabled, what am I doing wrong?
1 Answer