可以包含其他控件的自定义控件 [英] Custom control that can contain other controls

查看:129
本文介绍了可以包含其他控件的自定义控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如何创建自定义控件,将其内容包装在

页眉和页脚中?

例如:


是否可以创建一个.NET用户控件,它可以包含其他

控件?例如:

< my:RoundedCornerBox id = foo runat = server>

Content1

Content2

< / my:RoundedCornerBox>


呈现为:


< div class = foobar>

内容。

内容。

< / div>


我不认为这可以通过Web用户控件实现。


谢谢,


尼克...

PS以上示例大大简化但演示了概念

我需要做什么。

Hi,

How can I create a custom control which will wrap its content in a
header and footer?

eg:

Is it possible to create a .NET user control which can surround other
controls? eg:
<my:RoundedCornerBox id=foo runat=server>
Content1
Content2
</my:RoundedCornerBox>

renders as:

<div class=foobar>
Content.
Content.
</div>

I don''t think this is possible with Web User Controls.

Thanks,

Nick...
PS the above example is vastly simplified but demonstrates the concept
what I need to do.

推荐答案

" Nick Gilbert" < ni *** @ newsgroup.nospamwrote in message

news:on ************** @ TK2MSFTNGP04.phx.gbl ...
"Nick Gilbert" <ni***@newsgroup.nospamwrote in message
news:On**************@TK2MSFTNGP04.phx.gbl...

我不认为这可以通过Web用户控件实现。
I don''t think this is possible with Web User Controls.



如果你的意思是这样的: http://www.markrae.com/contact/quote.aspx


那么它肯定是可能的......: - )


这就是你的意思......?

If you mean something like this: http://www.markrae.com/contact/quote.aspx

then it most certainly is possible... :-)

Is that what you mean...?


如果你的意思是这样的: http://www.markrae.com/contact/quote.aspx
If you mean something like this: http://www.markrae.com/contact/quote.aspx

>

然后它肯定是可能的...... :-)


这就是你的意思......?
>
then it most certainly is possible... :-)

Is that what you mean...?



是的,这几乎就是我所需要的 - 只是绿色:)


你是怎么做到的?


尼克......

Yes that''s almost exactly what I need - just in green :)

How did you do that?

Nick...


如果你的意思是这样的话: http://www.markrae.com/contact/quote.aspx
If you mean something like this: http://www.markrae.com/contact/quote.aspx

>

那么它肯定是可能的...... :-)


这就是你的意思......?
>
then it most certainly is possible... :-)

Is that what you mean...?



是的,这几乎就是我所需要的 - 只是绿色:)


你是怎么做到的?


尼克......

Yes that''s almost exactly what I need - just in green :)

How did you do that?

Nick...


这篇关于可以包含其他控件的自定义控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆