Solved

Passing parameters via querystring

Posted on 2010-08-17
6
1,247 Views
Last Modified: 2012-05-10
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
Comment
Question by:TimBurraston
6 Comments
 
LVL 1

Expert Comment

by:evanstest
ID: 33456219
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
 

Author Comment

by:TimBurraston
ID: 33456331
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
 
LVL 1

Accepted Solution

by:
evanstest earned 250 total points
ID: 33456556
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 42

Assisted Solution

by:zephyr_hex
zephyr_hex earned 250 total points
ID: 33456681
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
 

Author Comment

by:TimBurraston
ID: 33499126
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
 
LVL 4

Expert Comment

by:leopolde
ID: 33918847
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

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now