I need to show the hyperlink of the text based on user permission in my custom web part, I know about SharePoint trimmed control feature, but I am not sure how to apply this feature for Hyperlink, I tried for button It's working perfectly, for links I don't how to use this

I tried this:

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat=

"server" PermissionsString="AddAndCustomizePages">
        <asp:HyperLink ID="link" runat="server" Target="_blank" Text="New way " />

                <a href='javascript:openUpcomingEventsDialog("/Lists/test/NewForm.aspx?IsDlg=1")'>
                    <span class="glyphicon glyphicon-plus" style="margin-right: 10px; float: right; top: 4px;" role="button" data-toggle="modal"></span></a>

but this is hiding the entire text for members, I need to disable the only link for text "New way"


If you're looking for a different approach than using SharePoint:SPSecurityTrimmedControl and are up to using javascript, you could by default disable the hyperlink and then through javascript check to see if the current user is part of group that is allowed to use the link and if they are enable it. Does that make sense?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.