Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:41:21+00:00 2026-06-17T16:41:21+00:00

I have created a DVWP dropdown for filtering a list which I’ve shown using

  • 0

I have created a DVWP dropdown for filtering a list which I’ve shown using a DVWP. I’ve set an year list as the dropdown DVWP data source and on selecting a year, i wanna filter the list DVWP to show the items filtered by year.

The dropdown:
<select name="ID" size="1"
onchange="document.location.href='http://server/site.aspx' + '?' + 'year' + '=' + this.options[selectedIndex].value">
.

I’ve added a QueryString parameter param1 which takes its value from Year to this dropdown as well as the list DVWP. In the list DVWP, I’ve added a filter condition which is: Year equals [Param1]. Note: Year here is a calculated column which gets year from a date field.

My question is even though the dropdown gets post back after selecting a value, it doesn’t get filtered. What have I done wrong in this? I’ve been racking my brains on this but I can’t get this to work no matter what I try. Please help.

<xsl:template name="dvt_1">
            <xsl:variable name="dvt_StyleName">Table</xsl:variable>
            <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
            <xsl:variable name="dvt_FieldNameNoAtSign" select="substring-after($dvt_filterfield, '@')" />
            <xsl:variable name="dvt_FilteredRowsText" select="$Rows[.=$dvt_filterval or ($dvt_filtertype='date' and substring-before($dvt_filterval,'T') = substring-before(.,'T'))]" />
            <xsl:variable name="dvt_FilteredRows" select="$Rows[normalize-space(*[name()=$dvt_filterfield])=$dvt_filterval or ($dvt_filtertype='date' and substring-before($dvt_filterval,'T') = substring-before(normalize-space(*[name()=$dvt_filterfield]),'T'))]" />
            <xsl:variable name="dvt_FilteredRowsAttr" select="$Rows[normalize-space(@*[name()=$dvt_FieldNameNoAtSign])=$dvt_filterval or ($dvt_filtertype='date' and substring-before($dvt_filterval,'T') = substring-before(normalize-space(@*[name()=$dvt_FieldNameNoAtSign]),'T'))]" />
            <xsl:variable name="dvt_RowCount">
                <xsl:choose>
                    <xsl:when test="$dvt_adhocfiltermode != 'query' and $dvt_filterfield">
                        <xsl:choose>
                            <xsl:when test="starts-with($dvt_filterfield, '@')"><xsl:value-of select="count($dvt_FilteredRowsAttr)" /></xsl:when>
                            <xsl:when test="$dvt_filterfield = '.'"><xsl:value-of select="count($dvt_FilteredRowsText)" /></xsl:when>
                            <xsl:otherwise><xsl:value-of select="count($dvt_FilteredRows)" /></xsl:otherwise>
                        </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise><xsl:value-of select="count($Rows)" /></xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:variable name="RowLimit" select="10" />
            <xsl:variable name="FirstRow" select="$dvt_firstrow" />
            <xsl:variable name="LastRow">
                <xsl:choose>
                    <xsl:when test="($FirstRow + $RowLimit - 1) &gt; $dvt_RowCount"><xsl:value-of select="$dvt_RowCount" /></xsl:when>
                    <xsl:otherwise><xsl:value-of select="$FirstRow + $RowLimit - 1" /></xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0 or $RowLimit = 0" />
            <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0"/>
            <xsl:call-template name="dvt_1.toolbar">
                <xsl:with-param name="Rows" select="$Rows" />
            </xsl:call-template>
            <xsl:choose>
                <xsl:when test="$dvt_IsEmpty">
                    <xsl:call-template name="dvt_1.empty"/>
        </xsl:when>

Is this what you were looking for?

Umm, if this helps, in the list that I’m using to populate the dropdown, the ‘Year’ field has an internal name @Title. Would that have something to do with this?

<xsl:template name="dvt_1.rowview">
<option>
<xsl:value-of select="@Title" />
</option>
</xsl:template>
. But it also has @Year, so not sure which is which.
<td class="ms-vb">
<xsl:value-of select="@Year"/>
</td>


Oops, sorry for confusing. The 2nd @Year is the calculated column which I’d created.
UPDATE 2: The code you’d requested:

<td class="ms-toolbar" nowrap="nowrap">
                                <xsl:call-template name="dvt.filterfield">
                                    <xsl:with-param name="fieldname">@Year</xsl:with-param>

                                    <xsl:with-param name="fieldtitle">Year</xsl:with-param>

                                    <xsl:with-param name="Rows" select="$Rows" />

                                    <xsl:with-param name="fieldtype">text</xsl:with-param>

                                </xsl:call-template>

Something like this has been created for both the dvwp’s:
<xsl:param name="ListID">{6889CA36-79AC-4FA8-9F0A-C013C944B3C5}</xsl:param>
<xsl:param name="Param1" />

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:41:22+00:00Added an answer on June 17, 2026 at 4:41 pm

    I just noticed(thanks to a colleague of mine) that Year which is a calculated column is as a string. So, for 2013, it was storing it as 2,013 because of which I couldn’t filter the DVWP properly. I used =TEXT(([columnname], "yyyy") instead of YEAR([colname]) and everything worked fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple multicast player using actinscript 3 which works fine and
I have created an IEnumerable list of racing drivers using LINQ from a string
I have created a windows service which is set to start automatically. This service
I have created a query for data using the WsapiDataStore request. When data is
I have created an android application that calls (using kSOAP library) a SOAP based
I have created two imageViews promatically as shown below: public void createImageViews(Integer count){ ImageView[]
I have created a google map displaying markers and the weather layer using Google
I have created a simple javascript class using the 'function' technique. In the class
I have created a search module which uses AJAX to display the results without
Have created a ATL COM project through which I am inserting Menu Items to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.