![](/img/trans.png)
[英]user control that other developers can add controls to it and “inherit” the behavior of all controls on my control
[英]Can i add optional values to my user control (creating intelisence of my own for me user controls)?
我需要為我的應用程序添加一些UC,並且希望啟用僅將我選擇的值輸入到我的UC參數中,為此我需要在程序員將UC添加到應用程序中並選擇使用參數。
當程序員選擇UC的參數時,是否有一種方法可以創建實時的可選值以彈出?
10倍:-)
不知道這是否是您的確切意思,但是如果您在用戶控件的代碼背后創建了一個公共屬性,則該屬性將顯示在標記中的intellisense中。
同樣,如果在后面的代碼中使用枚舉,則在鍵入標記時,有效選項將以智能感知方式彈出。
這是一個例子:
// FooControl.ascx.cs
namespace WebApplication1
{
public enum TypeEnum
{
Asynch = 0,
Synch = 1,
OneShot = 2
}
public partial class FooControl : System.Web.UI.UserControl
{
public TypeEnum Type { get; set; }
}
}
然后在標記中:
<Foo:FooControl ID="Foo1" runat="server" Type="Asynch" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.