하는 INamingContainer를 패널을 확장 및 구현하는 클래스 구현 : 방법에 다음
public Container ContainerContent
{
get
{
EnsureChildControls();
return content;
}
}
[TemplateContainer(typeof(Container))]
[TemplateInstance(TemplateInstance.Single)]
public virtual ITemplate Content
{
get { return templateContent; }
set { templateContent = value; }
}
:
다음
public class Container: Panel, INamingContainer
{
}
, 당신의 CustomPanel 유형 컨테이너의 속성과 타입 ITemplate의 또 다른 속성을 노출 할 필요를 CreateChildControls()
을 다음에 추가하십시오.
if (templateContent != null)
{
templateContent.InstantiateIn(content);
}
<uc:customPanel title="My panel">
<Content>
<h1>Here we can add whatever HTML or ASP controls we would like.</h1>
<asp:TextBox></asp:TextBox>
</Content>
</uc:customPanel>
나는이 작업을 수행하지 못할 생각 ...하지만 요는 조금하시기 바랍니다 지정할 수 있습니다 UR 사용자 컨트롤 –
의의 .ascx에서 그것을 할 수 있습니까? 내가 잘 작동하는 내 ascx 파일에 <%=title%>과 <%=content%>을 가지고 있지만 그것은 사용자 정의 HTML을 content 속성에 전달하는 고통입니다. – ademers
System.Web.UI.UserControl에 속성 텍스트 상자가 없습니다. –