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

Asp-netweb用户控件在设计时的呈现

  •  0
  • joeriks  · 技术社区  · 14 年前

    public override void RenderControl(HtmlTextWriter writer)
    {
     if (this.DesignMode) 
      writer.Write("<p>In design mode</p>");
     else
      base.RenderControl(writer);
    }
    

    3 回复  |  直到 14 年前
        1
  •  1
  •   Community CDub    8 年前

    使用从UserControl派生的控件是不可能的。另请参见 How to hide the inner controls of a UserControl in the Designer?

        2
  •  1
  •   TheGeekYouNeed    14 年前

    您需要为控件创建自定义设计器。从网上开始读吧 MSDN

        3
  •  0
  •   atlaste    11 年前

    Visual studio不支持此操作。当你指定“用户控制”这个词的时候,这个东西就会变成beserk并呈现你在上面放置的所有东西。显然,这是自2008年以来的情况。。。

    您可以将用户控件转换为服务器控件,这是一个很大的难题。或者。。。

    可以 http://www.codeproject.com/Tips/773145/Hiding-contents-in-ASP-Net-user-control-designer