Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 6th, 2007, 04:07 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP.NET XSL Parameter Problem

My site uses a XML/XSL transformation using an ASP.NET page, and I'm trying to reset one of the XSL doc's parameters depending on a querystring value (ex: default.aspx?record_id=pw). But I'm getting an error, and I'm not sure how to solve it. This is what I have so far:

ASP.NET DOC
Code:
'Assign XML and XSLT docs
Dim strThisPage_xml As String = "/docs/xml/default.xml" 'XML doc string
Dim strThisPage_xsl As String = "/docs/xslt/default.xsl" 'XSLT doc string

'Declare querystring variable
Dim recordId_qs As String = Request.QueryString("record_id")

'Create the XsltArgumentList object
Dim args As New XsltArgumentList()
args.AddParam("record_id", "", recordId_qs)

'Assign maincolumn XML/XSLT transformation properties
xslTransform_mc.DocumentSource = strThisPage_xml
xslTransform_mc.TransformSource = strThisPage_xsl
xslTransform_mc.TransformArgumentList = args
RESULT:
ERROR:
System.ArgumentNullException: Value cannot be null.
Value cannot be null. Parameter name: parameter

And if I add the following code above the "Assign maincolumn XML/XSLT transformation properties" set of code, it works:
'Declare default querystring variables
If recordId_qs = "" Then
    recordId_qs = "default"
End If

But I obviously know that this isn't the correct way to solve it. I read some stuff on how to dataset, but do I need to do the same for a string? Anyway, if you could point me in the right direction, that would be very helpful. Thanks.

KWilliams
 
Old July 6th, 2007, 04:43 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I received this answer from another forum, and I wanted to make sure to post the code:

Dim args As New XsltArgumentList()
If recordId_qs <> "" Then
   args.AddParam("record_id", "", recordId_qs)
End If

I can't believe that I didn't figure out that one on my own. Anyway, there it is:)

KWilliams





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Pass Parameter to Sub Report in asp.net 2.0 jawad Ahmed Crystal Reports 2 March 1st, 2008 02:17 AM
Pass link values as xsl:parameter to php5 then xsl pauljr8 XSLT 1 July 2nd, 2007 10:32 PM
XSLT Parameter to ASP.NET Variable kwilliams XSLT 9 February 9th, 2006 04:27 PM
Pass parameter from XSLT to ASP.NET kwilliams XSLT 3 August 17th, 2005 11:56 AM
XSL Parameter xsl:param Harinath Chikoti XSLT 1 May 6th, 2005 03:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.