简体   繁体   中英

Why does using <%=ConfigurationManager.AppSettings(“MySetting”)%> cause href attribute not to render in asp:HyperLink?

I am trying to bind a HyperLink control's NavigateUrl property in the markup using a server tag like so:

<asp:HyperLink ID="lnkHelp" runat="server" NavigateUrl='<%#ConfigurationManager.AppSettings("HelpUrl")%>'>Text</asp:HyperLink>

The IDE recognizes it and I even get intellisense, but the tag ends up rendering without the href attribute. I've discovered <%$ AppSettings:HelpUrl%> and I have started using this, but I don't get intellisense with it. That's not a deal breaker, but intellisense is just nice. That's a question for another time, though, so I am mainly just wanting to know why using <%# %> causes the href attribute not to render.

你应该这样使用

NavigateUrl='<%$ ConfigurationSettings.AppSettings["HelpUrl"] %>'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM