2

I have two DataFormWebparts on a page, one for creating new objects, one to edit them. The Webpart that creates them has this button :

<input type="button" value="Save" name="btnSave0" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__refresh;__redirect={Page.aspx?SelectedID_x003D__x007B_@ID_x007D_}')}" />

The actions for the button I have set from Sharepoint Designer 2010, as follows:

  • Commit
  • Refresh
  • Navigate to page (same page but with parameter SelectedID set with value:
    ',/dsQueryResponse/Rows/Row/@ID,'

The logic that should happen is: save the object, then redirect to the same page but with the ID of the newly created object in the XsltListviewWebPart.

What actually happens, the redirect works but to:

https://domain.com/SitePages/Page.aspx?SelectedID=%27,/dsQueryResponse/Rows/Row/@ID,%27

I see two problems, first -the redirected URL seems to be encoded. Second, the parameter is simply taken as string, not considered as an actual parameter.

Can anyone please give a hint on what's going on?

1 Answer 1

2

try replacing this:

<input type="button" value="Save" name="btnSave0" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__refresh;__redirect={Page.aspx?SelectedID_x003D__x007B_@ID_x007D_}')}" />

with

<input type="button" value="Save" name="btnSave0" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__refresh;__redirect={Page.aspx?SelectedID={@ID}}')}" />

if that doesn't works, you can use substring(@ID,[start-index],[length]) or substring-after or substring-before in xslt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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