I have my UserControls in the ~ / Controls folder in my solution:
/Controls/TheControl.ascx
If the following is indicated:
<a id="theId" runat="server" href="./?pg=1">link text</a>
It seems that ASP.Net wants to rewrite the path to an absolute location. For example, if the control is on site.com/products/fish/cans.aspx, the href link will be overwritten for reading
<a id="munged_theId" href="../../Controls/?pg=1>link text</a>
Why is Asp.Net rewriting these control paths and is there an elegant way to fix it?
I just want the anchor control to spit out exactly what I'm telling him !!! Is it that hard?
EDIT:
I basically did what Kelsey suggested. I knew I could do it this way, but I don't like adding markup to my code when I want something relatively simple. At least this solves the problem:
Aspx Page:
<asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder>
Code for:
var anchor = new HtmlGenericControl("a") { InnerText = "Previous" + " " + PageSize) };
anchor.Attributes["href"] = "?pg=" + (CurrentPage - 1);
anchor.Attributes["class"] = "prev button";
ph.Controls.Clear();
ph.Controls.Add(anchor);
, , , . , Literal, , , .
, ASP.Net URL.