Solved

Passing parameters via querystring

Posted on 2010-08-17
6
1,292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 
LVL 43

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
Experts-Exchange users below are the steps you can follow to upgrade your Lync server to latest CU's or cumulative updates. Note: Perform it during non-production hours.   Step 1: Backup your lync and SQL server database. Follow below article: h…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 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