Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Problem reading Datafile name and location from Web.Config
posted

NEVER MIND. I found out that a different control on the page was generating an error which caused the overall problem.

--------------------------------------------------------------------------------

I have a simple Hierarchial Grid. It works exactly right when I have this for the datasource:
<asp:XmlDataSource ID="XmldsFlightReservedGrid" runat="server"datafile="C:\Work\FlightGrid.xml"
XPath="Flights/Flight">
asp:XmlDataSource>

However, if I try to store the file name and path in the web.config I get the following error:
If I try to open the page in a browser -
Server Error in '/' Application.
--------------------------------------------------------------------------------
Data source of type XmlDataSource is not supported.

And when I am in design view
Error Creating Control  - XmldsFlightReservedGrid
Property accessor 'DataFile' on object 'System.Web.UY.Design.WebControls.XmlDataSourceDesigner' threw the following exception:'Object reference not set to an instance of an object.'

Here are my settings. I am using NetAdvantage 11.1 and .NET framework 4.0
<asp:XmlDataSource ID="XmldsFlightReservedGrid" runat="server"datafile="<%$ AppSettings:XMLFlightReservedPath %>" XPath="Flights/Flight">
asp:XmlDataSource>

<appSettings>
   
<add key="XMLFlightReservedPath" value="C:\Work\FlightGrid.xml"/>
appSettings>

Any help would be greatly appreciated.