If you are using a template item, then you could do something as simple as:
Code:
<script runat="server">
Public Function AllowDelete(ByVal propToAnalyze As String) As String
Select Case propToAnalyze
Case "Apples"
Return False.ToString
Case "Bananas"
Return True.ToString
End Select
End Function
</script>
<asp:DataGrid ID="MyDataGrid" runat="server">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button ID="DeleteButton" runat="server" Enabled='<%# AllowDelete(Eval("aDataBoundField")) %>' />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Otherwise if you want to have a lot of control of the template column and be able to reuse it on other grids, then look into extending the System.Web.UI.WebControls.TemplateColumn class. This method is powerfull and if you use it then you'll likely see potential for new ideas on how you can use datagrids as well.
Bookmarks