asp.net - My <% %> not working in div. Why? -
i've tried both snippets below. nothing. i've tried <%#, <%=, , <%. nothing. i'm stuck.
<div style="background-color:gray; color:white; text-align:center; width:100%;"> <asp:hyperlink id="hyperlink1" target="_blank" navigateurl='<%= server.htmlencode(string.format("~/showhistory.aspx?section={0}&jobnumber={1}", "apqp header", "101244")) %>' runat="server">show updated history</asp:hyperlink> <asp:hyperlink target="_blank" navigateurl="~/showdeletedhistory.aspx" id="hyperlink2" runat="server">show deleted history</asp:hyperlink></div> <br /> <div style="background-color:gray; color:white; text-align:center; width:100%;"> <asp:hyperlink id="hyperlink1" target="_blank" navigateurl='<%= string.format("~/showhistory.aspx?section={0}&jobnumber={1}", "apqp header", "101244") %>' runat="server">show updated history</asp:hyperlink> <asp:hyperlink target="_blank" navigateurl="~/showdeletedhistory.aspx" id="hyperlink2" runat="server">show deleted history</asp:hyperlink></div> <br />
server controls cannot contain type of tags. reason "<%= %>" basically equal response.write, executes after page has gone through lifecycle, when response constructed. if use when setting value of server-side control property, value has resolved when (or little after) parsing page markup. reason cannot use "<%= %>" in server control.
if normal html tag, work, virtual url not.
is there reason you're not setting navigationurl in code? nicer me.
Comments
Post a Comment