开发者

Can i add optional values to my user control (creating intelisence of my own for me user controls)?

I need to add some UCs for my app and I want to enable to e开发者_开发问答nter to my UC parameter only values that i choose, for that i need to give the programmer the values while he/she is adding the UC to the app and choosing to use the param.

Is there a way to create a live of optional values to pop when the programmer choose the param of the UC?

10x :-)


Don't know if this is what you mean exactly, but if you create a public property in the code-behind of your User Control, that property will show up in intellisense in the markup.

Similarly, if you use an Enum in the code behind, the valid options will pop up in intellisense when you type in the markup.

Here's an example:

// 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; }
    }
}

And then in the markup:

<Foo:FooControl ID="Foo1" runat="server" Type="Asynch" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜