Question

I have added a menu item in edit control block(ECB) in document library(using following msdn article http://msdn.microsoft.com/en-us/library/ms473643.aspx)

Now i found that the custom action(menu Item) in ECB is displayed for both document item and document folder. So how to apply custom action only for document item?

Was it helpful?

Solution

Are you using list as your RegistrationType?

Try using ContentType as your RegistrationTypeand specify the guid of the Document Content Type (I think its 0x0101) in your RegistrationID.

OTHER TIPS

You will need to create a class which inherits from WebControl. This class will need to render out your menu item as you want it displayed.

You then need to use the ControlAssembly and ControlClass parameters from your CustomAction definition to specify this class.

Your class will need to detect the if the current item is a document or folder and render/not render itself accordingly.

I would get the control working first just displaying a link, then add the logic in later.

This is a good blog posting on the technique, its not for the ECB but the principals are the same.

Enjoy!

In your customAction use RegistrationType="FileType" to determine FILE and use a RegistrationId="doc" to determine a extension, my exemple use word document. ;-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top