locked
Data View Web Part breaks using query string ID after deleting list items RRS feed

  • Question

  • Hello,

    I'm using a data view web part to display a single list item form in a web part page. I'm filtering the DVWP using a unique query string and the ID of the list item.

    I deleted all my tests to release the solution to the public, when the DVWP broke with the error: "List item was deleted or cannot be found."

    Since each list item has a unique, sequential ID number, why would this break if I delete list items?


    Joe
    • Moved by Mike Walsh FIN Tuesday, June 21, 2011 6:35 AM DVWP questions are never General (From:SharePoint - General Question and Answers and Discussion (pre-SharePoint 2010))
    Monday, June 20, 2011 9:13 PM

All replies

  • Did you tried using different name for your query string variable?? for example instead of ID try using itemID..
    Thanks,
    Chanakya
    Microsoft Certified Professional
    My Blog
    Tuesday, June 21, 2011 5:38 AM
  • Chanakya, thanks for your reply! I'm using the variable "goid" rather than "ID".
    Joe
    Tuesday, June 21, 2011 1:48 PM
  • Hi,

    Could you please tell me the detailed steps about releasing the solution to the public?

    I had test in my local, it worked well.


    Xue-Mei Chang
    Wednesday, June 22, 2011 9:23 AM
    Moderator
  • Hi Xue-Mei, Thank you for your reply, it is much appreciated!

    My steps:

    1.     I created a data view web part in a web part page, and set a single item form to filter based on a query string filter.
    2. Then I add some test items in the custom list which the data view web part is linked to. All works well, I'm able to edit the items using my DVWP.
    3. I need to delete my test items so the public does not see them, and started add new, production items.
    4. Yet when I delete the test items, the DVWP no longer functions, showing the SharePoint error page with the "Item has been deleted" error for the production items.
    5. On a whim, I restored from recycle bin all items, and the DVWP now works.

     


    Joe
    Wednesday, June 22, 2011 3:20 PM
  • Any chance you can show us some of your DVWP's xsl/html markup.  Specifically the tag <SharePoint:SPDataSource  and <ParameterBindings

    Did you manipulate the XSL directly to work with your custom filters?
    Wednesday, June 22, 2011 11:08 PM
  • Hi J, thanks for your reply! I did not manipulate the XSL directly to work with the filter, but did modify it quite a bit to build the form i wanted.

    <SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;Value Type=&quot;Counter&quot;&gt;{GOID}&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;" UseInternalName="true" ID="dataformwebpart2"><SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{875420D1-6C62-4147-906B-74F62C20B305}"/><asp:Parameter Name="StartRowIndex" DefaultValue="0"/><asp:Parameter Name="nextpagedata" DefaultValue="0"/><asp:Parameter Name="MaximumRows" DefaultValue="1"/><WebPartPages:DataFormParameter Name="GOID" ParameterKey="GOID" PropertyName="ParameterValues"/></SelectParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{875420D1-6C62-4147-906B-74F62C20B305}"/></UpdateParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{875420D1-6C62-4147-906B-74F62C20B305}"/></InsertParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{875420D1-6C62-4147-906B-74F62C20B305}"/></DeleteParameters>
    	</SharePoint:SPDataSource>
    

    <ParameterBindings>					<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
    									<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
    									<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
    									<ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
    									<ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
    									<ParameterBinding Name="dvt_nextpagedata" Location="Postback;Connection"/>
    									<ParameterBinding Name="ListID" Location="None" DefaultValue="{875420D1-6C62-4147-906B-74F62C20B305}"/>
    									<ParameterBinding Name="GOID" Location="QueryString(goid)" DefaultValue=""/>
    								</ParameterBindings>
    


    Joe
    Wednesday, June 22, 2011 11:37 PM
  • Joe,

    offhand, it looks right.  Is it possible you hard-coded a value instead of $GOID somewhere in your XSL

    Thursday, June 23, 2011 12:17 AM
  • Is this the only DVWP on your page? Are there any closed web parts on the page? What modifications did you make to the DVWP?
    The SharePoint Hillbilly
    Fewer Big Words... More Pretty Pictures... http://www.SharePointHillbilly.com
    Thursday, June 23, 2011 1:07 PM