I am making use of an asp:GridView control and in it have the following TemplateField:
<asp:TemplateField HeaderText="Delete" >
<ItemTemplate>
<asp:ImageButton ID="imgbtnDeleteEntry" runat="server" ImageUrl="~/Images/gifs/delete.gif" AlternateText="Delete" ToolTip="Delete Entry" CommandName="DeleteEntry" CommandArgument='<%# Eval("id") %>' OnClientClick="return confirm('Are you sure you want to delete this entry?');" />
</ItemTemplate>
</asp:TemplateField>
I want to be able to set this TemplateField's Visible property in the page load event. This may be set to true or false based on the status of the user (i.e. administrator or otherwise).
The index of the column (within the GridView) will not remain the same value - as many other fields are set up dynamically before this TemplateField.
As such I want to be able to set the Visible property against the TemplateField with the ImageButton ('imgbtnDeleteEntry') in it.
How can I do this?
Thanks in advance.
Steve
<asp:TemplateField HeaderText="Delete" >
<ItemTemplate>
<asp:ImageButton ID="imgbtnDeleteEntry" runat="server" ImageUrl="~/Images/gifs/delete.gif" AlternateText="Delete" ToolTip="Delete Entry" CommandName="DeleteEntry" CommandArgument='<%# Eval("id") %>' OnClientClick="return confirm('Are you sure you want to delete this entry?');" />
</ItemTemplate>
</asp:TemplateField>
I want to be able to set this TemplateField's Visible property in the page load event. This may be set to true or false based on the status of the user (i.e. administrator or otherwise).
The index of the column (within the GridView) will not remain the same value - as many other fields are set up dynamically before this TemplateField.
As such I want to be able to set the Visible property against the TemplateField with the ImageButton ('imgbtnDeleteEntry') in it.
How can I do this?
Thanks in advance.
Steve