Solved

Passing parameters via querystring

Posted on 2010-08-17
6
1,258 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 42

Assisted Solution

by:zephyr_hex (Megan)
zephyr_hex (Megan) 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SharePoint 2013 Emulating SharePoint 2010 8 64
Sharepoint 2013 error 4 49
Set cookies HttpOnly and Secure 4 111
SSRS troubles 4 12
Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

19 Experts available now in Live!

Get 1:1 Help Now