asp.net user control, getting htmlAnchor resolve to href=“#”

后端 未结 10 1522
轻奢々
轻奢々 2020-12-29 04:58

How do you get a server control HTMLAnchor to have href=\"#\". It keeps resolving the \"#\" to the control path.


res         


        
10条回答
  •  醉梦人生
    2020-12-29 05:31

    EDIT: Includes nested paths

    My test project renders the correct link for me:

     http://localhost:2279/WebSite1/Default.aspx#
    

    ASPX:

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register src="control/WebUserControl2.ascx" tagname="WebUserControl2" tagprefix="uc1" %>
    
    
    
        
    
    
        

    Control:

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl2.ascx.cs" Inherits="WebUserControl2" %>
    " runat="server" >here
    

    Control Code-Behind:

    protected string URLHelper(string s)
    {
        return Control.ResolveUrl(s);
    }
    

提交回复
热议问题