locked
Redirectiion in DataView Webpart RRS feed

  • Question

  • HI Guys,
    I have Multiple item View DVWP(display.aspx) with Edit,Delete,Inset link Now when i Click Insert Link i am redirecting to Newpage.aspx where user can insert data which also DVWP with New Item Form 
    Now whenever user click 'Save' and 'Cancel' button i want to redirect to them  previous page ex  display.aspx page.

    Please help me on this 

    Thanks Ron
    Friday, November 13, 2009 9:21 PM

Answers

All replies

  • Whatever value you provide for the Source Query String variable is where the user will end up.  For example:

    http://servername/sitename/Lists/listname/NewForm.aspx?Source=/default.aspx
    will send the user to default.aspx in the root site.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services
    • Proposed as answer by Parvez Akkas Saturday, November 14, 2009 12:08 AM
    • Marked as answer by RonCe Saturday, November 14, 2009 2:27 AM
    Friday, November 13, 2009 9:33 PM
  • Thanks Marc,
    I have One Question in my case i dont have list form will this solution work for custom aspx page ?

    i have aspx page with Dataview webpart one for display and edit and other page for Insert 



    Thanks Ron
    Friday, November 13, 2009 10:41 PM
  • Hi Ron,

    As Marc mentioned in the previous post, you need to use the "source" query string. You can use your custom aspx page as the value for the "source" query string. The user will be redirected to that custom page.


    Saturday, November 14, 2009 12:10 AM
  • Thanks Marc and pl7626
    Thanks Ron
    Saturday, November 14, 2009 2:28 AM
  • You bet, Ron.  You may need to check that the actions on the form button include __redirectsource if you aren't returned to the Source location.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services
    Saturday, November 14, 2009 5:28 AM
  • Yeah Thanks for Head up  marc but figured that out :)
    Thanks Ron
    Monday, November 16, 2009 3:27 PM
  • Hi Marc
    I am not redricting to source page.
    here is page when user click Add New
    <a href="./AddClearnace.aspx?Source=./clearance.aspx"><img alt="" src="/_layouts/images/ICONGO.GIF" height="15" width="15" border="0"/>Add New</a>
    In AddClernace.aspx page

    <input type="button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirectsource')}" />
    but i get 404 error 

    did  i miss something here


    Thanks Ron
    Friday, November 20, 2009 8:54 PM
  • Ron:

    You're getting the 404 error because ./clearance.aspx is not a valid path.  The best way to do this is to set up a parameter that reads the current URL:

    <ParameterBinding Name="URL" Location="ServerVariable(URL)" DefaultValue=""/>

    and then use that parameter as the Source:

    <a href="./AddClearance.aspx?Source={$URL}"><img alt="" src="/_layouts/images/ICONGO.GIF" height="15" width="15" border="0"/>Add New</a>
    This way, the redirection will always come 'home' again, regardless what you may rename the page or where you might move it.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services
    Friday, November 20, 2009 10:18 PM
  • Thanks Marc.I did that but something weird is going on here when i save the page it automatically get rid of URL variable.

    any idea on this 


    Thanks Ron
    Monday, November 23, 2009 3:50 PM
  • SharePoint Desginer *may* strip it out if you don't have the URL parameter defined correctly.  At least that's the only thing I can think of.  I haven't seen that happen.

    M.


    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services
    Wednesday, November 25, 2009 1:43 AM