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'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

1 Answer 1

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

 
discard

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.