Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Hide/Show an ECB custom action from C#

$
0
0

I have added an ECB custom action and that works all very well but I would like to hide or display this custom action depending on some conditions that I can determine in C# and that are not related to the standard SharePoint permissions. 

I tried overloading the Render() method in the control class, setting Visible to false in the OnLoad or OnInit, etc but that had no effect at all. Please help.

<?xml version="1.0" encoding="utf-8"?><Elements xmlns="http://schemas.microsoft.com/sharepoint/"><Control
ControlAssembly="SPTest.CustomMenuItem, Version=1.0.0.0, Culture=neutral, PublicKeyToken={PublicKeyToken}"
                ControlClass="SPTest.CustomMenuItem.CustomItemAction" Sequence="50" Id="AdditionalPageHead"/><CustomAction Id="SPTest.CustomMenuItem.ButtonClicked"
                RegistrationType="ContentType"
                RegistrationId="0x0101"
                Location="EditControlBlock"
                ImageUrl="/_layouts/IMAGES/DOCLINK.GIF"
                Sequence="600"
                Title="Click Me!"
                Description="Writes out a file..."
ControlAssembly="SPTest.CustomMenuItem, Version=1.0.0.0, Culture=neutral, PublicKeyToken={PublicKeyToken}"
                ControlClass="SPTest.CustomMenuItem.CustomItemAction" ><UrlAction Url="javascript:__doPostBack('SPTest.CustomMenuItem.ButtonClicked',{ItemId});" /></CustomAction></Elements>

Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>