Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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>
...
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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