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>&nbsp;&nbsp;             <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>&nbsp;&nbsp;             <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

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -