I have a page that includes a gridview control showing a list of contacts associated with a selected record. I have used the footer of the gridview to allow users to add new contacts if they have the relevant permissions. If they do not have the relevant rights, I set the footer to invisible so they can no longer access the add contact controls. This seems to work fine.
I'm now trying to replicate this funtionality in the empty data template so users can add records if there are no associated contacts aready. This all works fine, except I have been unable to hide the add record futionality if the users don't have the correct privillages. I have set the empty data template including the add controls in asp page, and thought I could use the attached code snippet to change the EmptyDataTemplate. This code gets called ok, but the gridview still includes the original EmptyDataTemplate when it is rendered.
Am i going about this the right way?
//Replace add contact funtionality in the empty data template as user doesn't have rights
TemplateBuilder tmpEmptyDataTemplate = new TemplateBuilder();
tmpEmptyDataTemplate.AppendLiteralString("No contacts are assigned");
gvAssociatedUsers.EmptyDataTemplate = tmpEmptyDataTemplate;