views:

622

answers:

3

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?

A: 

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!

Charlie
The ControlAssembly and ControlClass parameters do not work for the ECB as this menu is rendered client side and not server side.
Lars Fastrup
A: 

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.

Hi Jay,Thanks for comments.... u are very right....A list of content type ids is at following link(Very very useful link) http://grounding.co.za/blogs/brett/archive/2008/09/09/sharepoint-content-type-id-s.aspxIf u have any other link please share with me....
Anoop
A: 

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

Janissetti