• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1343
  • Last Modified:

Passing parameters via querystring

Hello sharepoint experts.

I have built a website for our project management activity.   I have a front page containing a DVWP for custom list which is the project register.  Using web part connections, when the user selects a project from the list, I link to a new page which displays the full project details for the selected project.  This all works fine.

I have created/modified lists for issues, risks, tasks etc. to include "Project ID" as a new column and I want to display these lists in DVWPs on separate pages using hyperlinks from the main project page.  I can filter the data on these pages/web parts to match the selected project  by including a Query String (URL) filter web part on these pages.  My problem is that I can't figure out how to pass the Project ID of the selected project from the main project page via the query string.  I want to use something like:
 <a href="prequest.aspx?ProjectID={$ProjectID}";>Project Request</a>
but am lost as to how I get the current project ID from the DVWP (i.e. the ID of the project being displayed) as a parameter value in the URL's query string.

I hope this makes sense to someone.

Many thanks
0
TimBurraston
Asked:
TimBurraston
2 Solutions
 
evanstestCommented:
Do you mean you don't know how to configure the DVWP to read the parameter from the URL query string and filter based on its value?

If so, you would include the ProjectID in the URL as a parameter as you describe, eg prequest.aspx?ProjectID=xxxxx

Then using sharepoint designer (cannot do it from browser) open the page containing the DVWP that you want to read the query string.

On the DVWP, click the arrow to display the "Common Data View Tasks" pop-up.

From the pop-up select "Parameters".

On the "Data View Parameters" screen, select "New Parameter".

Give the new parameter a name such as "QProjecttID".  Under Parameter Souce: select "Query String".  Then under "Query String Variable" enter the name of the parameter in the URL, eg ProjectID.

Then click "OK".  This will cause the DVWP to read the URL parameter ProjectID when the page loads and store it as a parameter called QProjectID.  The next step will set up a filter.

Go back to the "Common Data View Tasks" pop-up and now select "Filter".

Under FieldName select the column name for the column that contains your ProjectID.  For comparison select equals.  Then for value select the parameter QProjectID.

Then click "OK" to save the filter.

Now the DVWP will filter itself based on the value of parameter QProjectID each time the page loads.

Hope this helps.







0
 
TimBurrastonAuthor Commented:
evanstest, no, I'm ok with that and if I manually set the URL with, say, ?ProjectID=4, the DVWP's on the target pages only display the items relevant to the project Iam working with.  My problem is how to get the sending page (i.e. the main project page which was invoked from the project register via a web part connection) to set the query string parameter in the URL of the subsequent page(s) as in part 3 of this sequence:

1) select project from the Project register DVWP; 2) invokes the project main page and displays the appropriate project header details; 3) hyperlinks or buttons to link to issues, tasks, risks etc. for the selected project.

Thanks
0
 
evanstestCommented:
sorry I misunderstood your question.

How are you displaying the project header information on the main project page?  Is it a DVWP, Form Web Part, etc?

I have done something similar before where I display data similar to the project header details in a Data Form Web Part with all fields formatted to show text or rtf, etc (i.e read only).  Then you can add sharepoint Form Action Buttons to the Data Form.

To set up navigation on a particular button, right click on the button and then select "Form Actions".  Select "Navigate to Page" and then click the "Add>>" button.  This will add it to the "Current Actions".  Then click "Settings" to configure the page navigation.  Click the "Browse" button to set the target page.  This will actually load the "Edit Hyperlink" dialog.  From here you can enter the navigation URL.  Now you can also click on the "Parameters" button.  From here you can select fields and parameters to add to the URL using the "Add" button located under the Query String option.

Hope I understood this time but apologies if I am still misunderstanding





0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
zephyr_hex (Megan)DeveloperCommented:
i have done this.

see here:
taking the field value from the DVWP and passing in the url:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/MS-SharePoint/Q_24780905.html#25498908

accepting in the value from the url on the second page:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/MS-SharePoint/Q_24780905.html#25498969
0
 
TimBurrastonAuthor Commented:
Thanks zephyr, this all works great now!  This has prompted me to delve further into the murky depths of XSL!
evanstest, thanks for your input too.
0
 
leopoldeCommented:
Hi Evanstest,

I have been trying your method, but found that SPD creates the URL parameters as literal values, instead of sending their content; i.e. {@ID} is sent literally instead of sending its value.

Have you managed to solve this issue?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now