My work recently upgraded our CMS system to be a master-content page setup, as opposed to our old user control setup. The nav menu is still a user control so it can be dragged/copied/cut into places it need be. Well, the menu, prior to this system upgrade, was upgraded to CSS Friendly Menu Adapters (just for your guys' information) and worked perfectly. Well, after using said menu in said system for a while, a time came where a client wanted some icons in the nav, and I thought 'Static Item Template'. I tried it and got the following error:
Server Error in '/st_disc_unlimited' Application.
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details: System.InvalidOperationException:
Databinding methods such as Eval(), XPath(), and Bind() can only be
used in the context of a databound control.
Source Error:
Line 19: <StaticSelectedStyle CssClass="mnuStaticSelected" ItemSpacing="0px" /> Line 20: <StaticItemTemplate> Line 21: <asp:HyperLink ID="HyperLink1" runat="server" Font-Underline="false" Width="100px" NavigateUrl='<%# Eval("NavigateUrl")%>'><%# Eval("Text") %></asp:HyperLink> Line 22: </StaticItemTemplate> Line 23: </asp:Menu> |
Note I included the static item template in there for all to see the code it doesn't like. This is code that is tried and true; it's been used else where with success and I saved the code. All I need is the top level to have a static item template. Even if someone can find a work-around/solution for the present issue, of which I'm sure there are solutions many, we would like to be able to use this template in the future.
The template worked fine in a sandbox application in which I tested the menu in a user control format, standard in-the-page format (just placed in the aspx) and the master page setup, with and without the CSS Adapters and was not able to recreate the issue, making me think it's an issue specific to our CMS. I haven't found so much as a mention of this issue in any forums/posts or google search pages. If anyone knows what's going on or has a blind stab, any help is appreciated.
Thanks in advance,
~Justin