SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a new feature for a specific list. This new feature will show a button in the EditToolBar of a list page when editing. After clicking that new button, it should take you to another page and display some data. I already added the xml files and also a .aspx files to the SharePoint folder and also installed the feature and activated it for that site.

Now, I can't get the current list and current item in my new aspx page by using SPContext.Current.List or SPContext.Current.Item. It gives an error.

Any ideas?

share|improve this question
up vote 0 down vote accepted

Pass through the List and Item IDs in the querystring?

The Context is lost in an application page I believe.

share|improve this answer
Thanks for your quick answer, How can I do that from a feature? I mean, How can I get the values of this in the feature xml file. – omar Sep 23 '10 at 18:10
How are you displaying the button in the toolbar in the first place? – James Love Sep 23 '10 at 18:19
Just by adding the line Location="EditFormToolbar" in the elements.xml of the feature. – omar Sep 23 '10 at 18:28
Ah, understood, and you have a separate link which links to your application page in the elements.xml, also. I think the easiest way to be able to dynamically add stuff to the querystring is to use a usercontrol for the button on the toolbar. – James Love Sep 23 '10 at 18:33
I found that adding this to the element URL of the xml file ?ItemId={ItemId}&ListId={ListId} that information is added to the URL. Thanks James – omar Sep 23 '10 at 18:38

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.