Greetings!
I have an XML value that I'd like to use as a boolean value to toggle the visibility of a Panel. I have something like this:
<asp:FormView id="MyFormView" runat="server" DataSourceID="MyXmlDataSource">
<ItemTemplate>
<!-- some stuff -->
<asp:Panel id="MyPanel" runat="server" Visible='<%# (bool)XPath("Menu/Show") %>'>
</asp:Panel>
<!-- some more stuff -->
</ItemTemplate>
</asp:FormView>
<asp:XmlDataSource id="MyXmlDataSource" runat="sever" DataFile="MyFile.xml" />
However, this throws an exception. I've tried setting the value of Show in my XML to "true", "True", "0", but to no avail. Is this even possible? My XPath definitely works because I've tried moving <%# (bool)XPath("Menu/Show") %> outside so that I can see its value and it is correct. I have tried this:
<%#((bool)XPath("Menu/Show")).ToString() %>
But this also throws an exception.
Thanks.