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

In SharePoint 2010 I'm getting a strange behavior. I have a custom content page with some custom web parts and some XsltListViewWebParts. I'm identifying a single entity by passing its id through the query string. But it appears that when "?Id=x" exists in the querystring of any page in SharePoint 2010 several buttons in the ribbon for list view web parts get disabled.

To test this out go to any page in a SharePoint 2010 site that lists multiple list items. Select several list items via the floating checkboxes. Confirm that a delete button is enabled. Add "?Id=x" to the query string. Select several list items. Confirm that the delete button is now disabled.

Anyone else getting this behavior? Is it a bug? Is it by design? I guess I can change my code around to call my parameter something else, but this seems like pretty bizarre behavior.

share|improve this question
    
Is there a solution to this problem? We're using two date parts, parameters and filters (with a listview) and all items display correctly. But, the ribbon view/edit options are disabled. This seems to be about 2yrs old... Any fix? –  user6830 Feb 9 '12 at 19:15
add comment

3 Answers 3

Had a similar issue a while back. Golden rule is do not use "ID" in you custom code to identify anything in your query string. It is part of some deep dark SharePoint mojo and should be considered a system keyword. You'll want some other identifier in your query string like myID.

share|improve this answer
add comment

The behaviour you describe does not only occur in the situation you describe.

Another test: Open a SharePoint list with items. Add ?id=3 to the query string. Select one item which id is not equal to three: delete button is disabled. When you select an item with id is 3 and with ?id=3 in the query string, the Delete button is enabled.

Based on this test I guess SharePoint uses the id internal when selecting an item/items from the list. When the id of the selected item does not match the id in the query string buttons which interact with a single item are not enabled.

When checking the core.js file on the definition of the delete item function the id is used definitely. In the core.js the definitions of the functions behind the button are listed, but not the code which enables or disables the button. So I can't check this.

Treat the id as reserved word, you are free to use something else.

Regards, Anita

share|improve this answer
add comment

Your Answer

 
discard

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