Link to home
Start Free TrialLog in
Avatar of TimBurraston
TimBurraston

asked on

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
Avatar of evanstest
evanstest

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.







Avatar of TimBurraston

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of evanstest
evanstest

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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?