Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
in one file (somethingName.xml.congif) i add this code - xsl template

at the thop

HTML
<query name="Product" rowElementName="ProductInCampaign" runif="showproduct">
  <sql>
    <![CDATA[
    exec dbo.aspdnsf_getCampaignData @ProductID

  </sql>
  <queryparam paramname="@ProductID"       paramtype="request" requestparamname="ProductID"       sqlDataType="int" defvalue="0"  validationpattern="^\d{1,10}$" />
</query>

then
C#
<xsl:template name="ProductInCampaignID">
  <xsl:param name="CampaignID" select="aspdnsf:_getCampaignData(ProductID)"></xsl:param>
  <div class="CampId">
    <xsl:value-of select="$CampaignID" />
  </div>
</xsl:template>


and then i call this template
C#
<xsl:call-template name="ProductInCampaignID"></xsl:call-template>


In MS SQL database i have this procedure
SQL
ALTER PROCEDURE [dbo].[aspdnsf_getCampaignData]
	@ProductID int
AS
BEGIN
	SET NOCOUNT ON;

	SELECT FK_Campaign FROM ProductInCampaign WHERE FK_Product=@ProductID
END


When i run my project, i get this exception
XmlPackage Exception: Exception=Last Trace Point=[]. Extension object 'urn:aspdnsf' does not contain a matching 'getCampaignData' method that has 1 parameter(s).


System.ArgumentException: Last Trace Point=[]. Extension object 'urn:aspdnsf' does not contain a matching 'getCampaignData' method that has 1 parameter(s).

at AspDotNetStorefrontCommon.XmlPackage2.TransformString() at AspDotNetStorefrontCommon.AppLogic.RunXmlPackage(XmlPackage2 p, Parser UseParser, Customer ThisCustomer, Int32 SkinID, Boolean ReplaceTokens, Boolean WriteExceptionMessage)


Is there any file where i was supposed to define this procedure? Or go here for some other problem? Thanks
Posted
Updated 20-May-14 3:30am
v5
Comments
Member 10272815 20-May-14 9:15am    
It's been almost a year since I've touched Storefront, so I can't remember the specifics of how to do it, but the way you're trying to do it is going through C# extension code, not a stored proc. If I remember correctly, most of the pages have a query section at the top, that's where you'd specify a stored proc.
vezo11 20-May-14 9:28am    
Oh sorry.. I will update the question.. :)
Member 10272815 20-May-14 9:49am    
I think it's supposed to be something like this (I had to add spaces in the xsl tags to get them to show up, make sure you remove them):
< xsl:template name="ProductInCampaignID">
< xsl:for-each select="/root/Product/ProductInCampaign">
<div class="CampId">
< xsl:value-of select="CampaignID">
</div>
vezo11 20-May-14 10:03am    
Thanks, now i dont have any exceptions, but also values ​​are not displayed. But im closer than before :) i add this code:

< xsl:template name="ProductInCampaignID">
< xsl:for-each select="/root/Product/ProductInCampaign">
< div class="CampId">
< xsl:value-of select="CampaignID"/>
< p>fdsfas</p>
< /div>
< /xsl:for-each>
< /xsl:template>
vezo11 20-May-14 10:22am    
I have noticed that - i do not have anywhere parameter CampaignID, so i add it
< xsl:param name="CampaignId" select="aspdnsf:getCampaignData(ProductID)"/> , and new exception is "The variable or parameter 'CampaignID' is either not defined or it is out of scope." :/

1 solution

This problem is solved. At the top it is necessary to add query, like this
HTML
<query name="Product" rowelementname="ProductInCampaign" runif="showproduct">
    <sql>
      <![CDATA[
      exec dbo.aspdnsf_getCampaignData @ProductID
      ]]>
    </sql>
    <queryparam paramname="@ProductID" paramtype="request" requestparamname="ProductID" sqldatatype="int" defvalue="0" validationpattern="" />
  </query>


then xsl template
HTML
<xsl:template name="ProductInCampaignID" xmlns:xsl="#unknown">
  <xsl:for-each select="/root/Product/ProductInCampaign">

    <div class="CampId">
      <xsl:value-of select="FK_Campaign" />
      <p>fdsfas</p>
    </div>
  </xsl:for-each>
</xsl:template>


and call this template
HTML
<xsl:call-template name="ProductInCampaignID" xmlns:xsl="#unknown"></xsl:call-template>


Thanks for the help Member 10272815 :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900