Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a list where I need the user to perform an action on each item (it will eventually start a workflow) so I was wondering without creating a webpart is it possible to add a button or link that can fire off some code related to the selected item?

Thanks

Dan

share|improve this question

3 Answers 3

up vote 0 down vote accepted

there are a lot of options but it really depends on what you mean by "fire off some code".

You can use the javascript api to do a ton of things in 2010. here is a presentation on codeplex about javascript features in sp2010 - http://code.msdn.microsoft.com/sps2010cljs

share|improve this answer
    
Well essentially for each item in the list a general user could click on something (button/link/action etc) lets say "Apply for post" which would fire off a workflow for approval. I have no idea how I'd do this so coming from a c#/web background I'm thinking of a button with some code that could initiate a workflow. I'll have a look at the link but if you have any suggestions for the above that would be appreciated! Thanks –  Anonymous Oct 12 '10 at 15:26
    
if you've got a c#/web background then all the context menu is doing is using javascript to fire events, some are server and some are client based. From this you shoudl be able to derive a solution that fits your needs. –  Brian Brinley Oct 12 '10 at 15:57
    
Also, adding a custom action like james love mentioned associates it to a list type(i.e.. generic list). So keep this in mind if your action wants to be to ALL lists of a given type or to a specific list. –  Brian Brinley Oct 12 '10 at 15:59
    
Thanks guys, I managed to get something going in the end with this thread: social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/… –  Anonymous Oct 13 '10 at 14:29

You could add a custom action to the ECB menu for a list.

share|improve this answer
    
This could work, do you know if any good examples? Thanks –  Anonymous Oct 12 '10 at 15:34
    
msdn.microsoft.com/en-us/library/ms473643.aspx This has a link to what a CustomAction element looks like for an ECB menu item. You can link to an application page, and pass through the Item and List IDs (using something like ?ItemID={ItemID}). –  James Love Oct 12 '10 at 17:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.