1

I am using SharePoint designer to build a page with a data view web part that displays the contents of a 6,000 record XML file that is structured like the example below with each "Details" element being a record.

<?xml version="1.0" encoding="UTF-8"?>
<Details_Collection>
   <Details>
      <Display_Name>Weather, Wendy</Display_Name>
      <Age>27</Age>
      <Gender>Female</Gender>
      <Marital_Status>Married</Marital_Status>
      <Email>person@test.edu</Email>
      <Site_Location>Denver, CO</Site_Location>
   </Details>
   <Details>
       ...
   </Details>
</Details_Collection>

I want to filter that DVWP by the Site_Location element using an ASP dropdown control. Rather than have to maintain a list of about a hundred Site Locations as choices in the dropdown control's code, I want to simply use that XML file as the data source for my dropdown's choices.

I can insert the XML data source onto the page just fine. But, when I select it as the data source for my dropdown and then preview the page, it gives me a web part error and the page won't load.

I assume that what I am doing is possible. Is it not working because my XML file doesn't have any schema information? It seems to be well-formed enough to load in the DVWP. After-all, the entire page works great UNTIL I associate the ASP dropdown with the data source. That's when it breaks.

0

I think you need sth. like this in your code:

...
<asp:DropDownList runat="server" id="siteLocationList{$Pos}" OnSelectedIndexChanged="javascript:openViewForSite();">
    <xsl:variable name="siteLocation" select="@answer"/>
    <xsl:for-each select="/Details_Collection/Details">
        <xsl:sort select="Site_Location"/>
        <asp:ListItem>
            <xsl:value-of select="Site_Location"/>
        </asp:ListItem>
    </xsl:for-each>
</asp:DropDownList>
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.