if (TabPermissionController.CanAddContentToPage(PageId, UserId)) { // Allow user to add content to the page } else { // Deny user access to adding content to the page }
var page = GetCurrentPage(); var currentUser = GetUser(); if (TabPermissionController.CanAddContentToPage(page.TabID, currentUser.UserID)) { // Show option to add content to the current page } else { // Hide option to add content to the current page }This example checks whether the current user has permission to add content to the currently viewed page. The code gets the current page's TabID and the current user's UserID, and passes these values to the CanAddContentToPage method. If the user has permission, the code displays an option to add content to the page. Otherwise, the option is hidden. Package/Library: DotNetNuke.WebControls (Official DNN library for web controls).