I'm using an XmlDataSource in my ASP.NET application as a way to prototype schema and data before actually implementing on SQL Server database. So far I am able to bind .NET controls to the XmlDataSource and corresponding XML file in the expected manner, but I am unable to filter out only the desired records without hardcoding it in the XPath. Using the following example, I'd like to only retrieve tasks from User_ID 1.
In SqlDataSource I would use SelectParameter, but I am not finding any documentation if this is possible with an XmlDataSource.
XML:
<?xml version="1.0" encoding="utf-8" ?>
<Tasks>
<Task>
<Task_ID>1</ID>
<User_ID>1</User_ID>
<Title>My Task</Title>
</Task>
<Task>
<TaskID>2</Task_ID>
<User_ID>2</User_ID>
<Title>Another Task</Title>
</Task>
</Tasks>
ASPX:
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~\App_Data\tasks.xml" XPath="//Tasks/Task">
</asp:XmlDataSource>