<asp:DataGrid id='DataGrid1' runat='server'>
<Columns>
<asp:TemplateColumn HeaderText ='Product Information' >
<ItemTemplate >
<asp:Button CommandName='Status' Text ='Status' Runat =server
Enabled =<%#CheckStatus(Convert.ToBoolean(DataBinder.Eval(Container.DataItem,'Discontinued')))%> ID='Button1' >
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
VB.NET
Protected Function CheckStatus(ByVal prdStatus As Boolean) As Boolean
If prdStatus = False Then
Return True
Else
Return False
End If
End Function
C#
protected bool CheckStatus(bool prdStatus)
{
//If the Discontinued field is '0'
if (prdStatus==false)
{
return true;
}
//If the Discontinued field is '1'
else
{
return false;
}
}
Share with