Note that there are some explanatory texts on larger screens.

plurals
  1. POasp:hyperlink not rendering correct HTML on server
    primarykey
    data
    text
    <p>I'm working on a project that is in ASP.NET WebForms on .NET 2.0 and am running into a problem I can't seem to find a cause for. I have the following code in my aspx file:</p> <pre><code> &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:HyperLink ID="supportLink" runat="server"&gt;Customer Support Docket&lt;/asp:HyperLink&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:HyperLink ID="entitlementsLink" runat="server"&gt;Edit Entitlements&lt;/asp:HyperLink&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>And when I run locally in debug mode, it works great. The links appear and the HTML is rendered properly as such:</p> <p><strong><em>Local Rendered HTML</em></strong></p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_supportLink" href="ViewCustomer.aspx?customerid=659"&gt;Customer Support Docket&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_entitlementsLink" href="EditEntitlements.aspx?customerid=659"&gt;Edit Entitlements&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>However, when I run it on my server in production, I get the following HTML generated:</p> <p><strong><em>Server Rendered HTML</em></strong></p> <pre><code> &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_supportLink"&gt;Customer Support Docket&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_entitlementsLink"&gt;Edit Entitlements&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>As you can see, the href is missing from both. In my code behind I am adding the URLs since I was having a hard time getting them to render properly in the aspx file:</p> <p><strong><em>Code Behind File</em></strong></p> <pre><code> protected void Page_Load(object sender, EventArgs e) { supportLink.NavigateUrl = string.Format("ViewCustomer.aspx?customerid={0}", Request.QueryString["customerid"]); entitlementsLink.NavigateUrl = string.Format("EditEntitlements.aspx?customerid={0}", Request.QueryString["customerid"]); } </code></pre> <p>At this point I'm not sure what I can do. My plan was to re-write this site in the next few weeks in MVC4 but seeing as this is an internal site and not generating money it is low on my priorities list and won't get much more attention for awhile, which means I need to fix this issue. </p> <p>The server environment is IIS 6 on Windows Server 2003 and the HTML renders this way in both IE9 as well as Chrome 24.0.1312.57. I have cleared the cache in both browsers to no avail and I know that the page is getting updated after a publish because other features that I added with the same change are actually working in production.</p> <p><strong><em>EDIT</em></strong></p> <p><a href="https://stackoverflow.com/a/14903824/509746">Rezalas</a> was wondering where I got the customerid from. It is from the query string. To show that a blank query string wouldn't cause this here is the local and production HTML with no query string:</p> <p><strong><em>Local Rendered With No Query String</em></strong></p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_supportLink" href="ViewCustomer.aspx?customerid="&gt;Customer Support Docket&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_entitlementsLink" href="EditEntitlements.aspx?customerid="&gt;Edit Entitlements&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p><strong><em>Production HTML With No Query String</em></strong></p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_supportLink"&gt;Customer Support Docket&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="ctl00_ContentMain_entitlementsLink"&gt;Edit Entitlements&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload