Make URL parameters available as variables in DVWP  
Author Message
mlg





PostPosted: Fri Dec 10 13:33:00 CST 2004 Top

WindowsServices >> Make URL parameters available as variables in DVWP

I have two web parts on a page - one is the view of the list I'm on,
and the other is a link list converted into a DVWP.

I want to make the ID parameter passed to the view available to the
link list.

I added the following to the <ParameterBinding> section of the DVWP at
the bottom:
<ParameterBinding Name="ProjectID" Location="QueryString(ID)"/>

but I don't know how to access that from within the dvt_1.body
template.

Help! :)

Windows OS280  
 
 
Ian





PostPosted: Fri Dec 10 13:33:00 CST 2004 Top

WindowsServices >> Make URL parameters available as variables in DVWP Hi,
Creating a Web Part connection between them with FrontPage should work.
If your "view of the list" is one of the built in list views as opposed to a
List View Web Part (subtle difference) then this demo may be relevant (or
not).
http://www.wssdemo.com/Project/default.aspx
Check out the Project Item Detail Page.

Regards,
Ian
http://www.wssdemo.com



>I have two web parts on a page - one is the view of the list I'm on,
> and the other is a link list converted into a DVWP.
>
> I want to make the ID parameter passed to the view available to the
> link list.
>
> I added the following to the <ParameterBinding> section of the DVWP at
> the bottom:
> <ParameterBinding Name="ProjectID" Location="QueryString(ID)"/>
>
> but I don't know how to access that from within the dvt_1.body
> template.
>
> Help! :)
>


 
 
Ryan





PostPosted: Fri Dec 10 16:27:02 CST 2004 Top

WindowsServices >> Make URL parameters available as variables in DVWP Well, I'm not trying to filter the link list - I should have been more
clear earlier.

I'm trying to include the ID parameter as a URL parameter for the links
in the link list.

Any ideas?
Your hint above helps with another task I have coming up, though. :)

 
 
Ryan





PostPosted: Fri Dec 10 17:36:15 CST 2004 Top

WindowsServices >> Make URL parameters available as variables in DVWP Figured it out.

1. Define the parameter you will use in your code.
a. At the top of the DVWP, add the following next to the other
parameters:
<xsl:param name="ProjectID"/>

2. Bind the URL parameter to the custom parameter in your DVWP:
a. Find the <ParameterBindings> group near the bottom of the DDVP
b. Add your parameter:
<ParameterBinding Name="ProjectID" Location="QueryString(ID)"/> <!--
"ID" is the name of the parameter to look for in the URL -->

3. In the dvt_1 template, initiate the variable:
<xsl:variable name="ProjectID" select="$ProjectID"/> <!-- probably
doesn't have to have the same name -->

4. In the appropriate <xsl:call-template /> block (in my case,
dvt_1.body) include that parameter:
<xsl:with-param name="ProjectID" select="$ProjectID"/>

5. Then, in the body of the template itself, include the value of the
variable in the appropriate place with:
<xsl:value-of select="$ProjectID" />


** There may be unnecessary steps above - I just hacked away until it
worked. **