いくつかのコントロール、テキストボックス、ラベル、ドロップダウンリストを含むカスタム Web コントロールを作成しようとしています。カスタム コントロールにプロパティを追加して、ドロップダウン リストに選択オプションを追加できるようにすることを同じ方法で行います。それが通常のドロップダウンリストである場合は、そうするでしょう。
<asp:DropDownList ID="normalddl" runat="server">
<asp:ListItem Text="1st value" Value="0"></asp:ListItem>
<asp:ListItem Text="2nd value" Value="1"></asp:ListItem>
</asp:DropDownList>
このようなカスタム コントロールが必要です (これは単純化されたバージョンです)。
<mycustomControl:ControlNamt ID="customddl" runat="server" >
<asp:ListItem Text="1st value" Value="0"></asp:ListItem> -- how would I go about adding this in the custom control?
<asp:ListItem Text="2nd value" Value="1"></asp:ListItem>
</mycustomControl:ControlNamt>