在ASP.NET中设计UI容器

时间:2011-10-25 14:11:52

标签: c# asp.net .net

我需要在ASP.NET页面的主体中创建这样的组件。我的页面有很多这些。对此使用什么控制?我应该创建一些自定义容器。我是ASP.NET的新手。 标题和内容应该能够具有图像背景。

编辑:我正在使用WebForms。

enter image description here

1 个答案:

答案 0 :(得分:0)

这取决于你需要它做什么。如果您正在寻找,可以使用Web用户控件:

<uc1:MyUserControl ID="UserControl1" HeaderText="Foo" Content="Bar" ... />

如果您正在寻找内容部分作为模板,那么继承自TemplateControl的自定义服务器控件更符合您的需求。

如果您正在寻找,则需要自定义服务器控件:

<cc1:MyCustomControl ID="MyCustomControl" HeaderText="Foo">
    <Content>
        <asp:TextBox ID="TextBox1" runat="server" />
    </Content>
</cc1:MyCustomControl>    
相关问题