代码之家  ›  专栏  ›  技术社区  ›  shsteimer

有什么方法可以防止母版页更改元素ID吗?

  •  7
  • shsteimer  · 技术社区  · 17 年前

    ctl00_MainPageContent_ ).

    <%= Element.ClientID %>

    3 回复  |  直到 17 年前
        1
  •  5
  •   Community Mohan Dere    9 年前

    Remove MasterPage Generated ID

    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
        Dim Html As New StringWriter()
        Dim Render As New HtmlTextWriter(Html)
        MyBase.Render(Render)
        writer.Write(Html.ToString().Replace("name=""ctl00$ContentBody$", _ 
                      "name=""").Replace("id=""ctl00_ContentBody_", "id="""))
    End Sub
    
        2
  •  4
  •   Phaedrus    17 年前

    here

    public override string UniqueID
    {
        get
        {
            return this.ID;
        }
    }
    
    public override string ClientID
    {   
        get
        {
            return this.ID;
        }
    }
    
        3
  •  1
  •   Barry Franklin    6 年前

    ClientIDMode="Static" .

    推荐文章