0

ユーザーが次のようなものを作成できるようにするユーザーコントロールを作成しようとしています:

  <uc1:MyControl id="controlThing" runat="server">

    <uc1:BoundColumn id="column1" Column="Name" runat="server" />
    <uc1:CheckBoxBoundColumn id="column2" Column="Selector" runat="server" />
    <uc1:BoundColumn id="column3" Column="Description" runat="server" />

     ...etc 

  </uc1:MyControl>

あらゆるタイプの多くを持つことができるという事実に加えて、私が許可する特定のコントロールのみがあります。これを XSD で描くことはできますが、ASP.NET については完全にはわかりません。

私の ASP.NET ブードゥー教は今、空白を描いています.何か考えはありますか?

4

3 に答える 3

2

The PersistenceMode.InnerProperty is what you want.. Here are the MSDN docs. Doing something like this will get you what you want:

[PersistenceMode(PersistenceMode.InnerProperty)]
public ListItem Items {
   get; set;
}

and then you'll be able to use it like this:

<cc1:MyControl runat="server">
   <Items>
       <asp:ListItem Text="foo" />
   </Items>
</cc1:MyControl>

You can create your own custom classes to use in there as well.

于 2008-10-09T03:44:43.737 に答える
0

ListView や GridView などの既存のコントロールをオーバーライドすることは可能ですか? それが最も簡単なオプションです。

ただし、独自のカスタム テンプレート コントロールを作成するには、ITemplate を使用する必要があります。

私はそれを行っていませんが、簡単なグーグルはこれを返しました: http://www.developerfusion.com/article/4410/in-depth-aspnet-using-adonet/2/良さそうでした。

私はそれをカバーする本「Developing Microsoft ASP.NET Server Controls and Components」を持っていますが、まだ詳しく読んでいません ( http://www.amazon.com/exec/obidos/ASIN/0735615829/nikhilkothari-20 )

于 2008-10-09T02:11:19.293 に答える
0

私が懸念している最も難しい部分は、ユーザー コントロール内で任意の数のユーザー コントロール セットをテンプレート化できることだと思います。

<mycontrol id="control1" runat="server">
    <templateitem id="bleh1" runat="server" />
    <templateitem id="bleh2" runat="server" />
    <templateitem id="bleh3" runat="server" />
     ..etc
</mycontrol>
于 2008-10-09T02:20:23.143 に答える