I've assigned some properties to that control, something like this (Title):
private string _title;
/// <summary>
/// Get or set Title of my grid panel.
/// </summary>
public string Title { get { return _title; } set { _title= value; } }
When I add my control in an aspx page and register it in the aspx page, I can list all properties like 'Title' of my control using intellisense support.
For some other properties of the control, I'd like to have a kind of list of allowed value for these properties, the same that happen for example for the columns of a grid view. When you have a grid view in your asp.net page and start typing '<', you see
that the intellisense shows allowed values, for example AlternatingRowStyle, Columns, etc...
If you select Columns, you can see that the intellisense shows you a list of available values you can choose, for example asp:BuondField, asp:ButtonField and so on.
Do there is an example of the code somewhere that shows how to create for an user control having some properties with a list of available values that are showed by the intellisense?
Whit the code you suggested, if I include my user control in a page and if I I start to type: 'Title', the intellisense suggest me all the value allowed for that property but it is not the goal.
I would have the following situation. Consider the example showed in the Link1, whenI add the control in the page and when I a start to type MessageTemplate and close the tag, then I would receive fron the intellisense some allowed value for MessageTemplate
node and I would customize this kind of allowed values.
I'm afraid I don't have any samples of this, and perhaps you can check with our
All-In One Code Framework site - that is a good place to go to ask for samples such as this.
garag
Member
2 Points
2 Posts
User Control Properties Intellisense
Sep 30, 2011 03:09 PM|LINK
Hi,
I've created an user control in a ascx file.
I've assigned some properties to that control, something like this (Title):
private string _title; /// <summary> /// Get or set Title of my grid panel. /// </summary> public string Title { get { return _title; } set { _title= value; } }When I add my control in an aspx page and register it in the aspx page, I can list all properties like 'Title' of my control using intellisense support.
For some other properties of the control, I'd like to have a kind of list of allowed value for these properties, the same that happen for example for the columns of a grid view. When you have a grid view in your asp.net page and start typing '<', you see that the intellisense shows allowed values, for example AlternatingRowStyle, Columns, etc...
If you select Columns, you can see that the intellisense shows you a list of available values you can choose, for example asp:BuondField, asp:ButtonField and so on.
Do there is an example of the code somewhere that shows how to create for an user control having some properties with a list of available values that are showed by the intellisense?
I hope the question is clear.
Thanks
Ahmed Moosa
Star
7784 Points
1232 Posts
Re: User Control Properties Intellisense
Sep 30, 2011 03:32 PM|LINK
hi ,
if you mean a Template like this:
<uc:usercontrol1 id="uc1" ..................>
<Title>
some soms omsome some
</Title>
</uc:usercontrol1>
you can use this links : Link1 , Link2
and if you mean that the Title Property have many Values , you declare this Property as Enum of Values like this :
public enum Values { Some1 , Some2, Some3 } private Values _vals; public Values Title { set { _vals = value; } get { return _vals; } }MCC - MCPD -MCTS
garag
Member
2 Points
2 Posts
Re: User Control Properties Intellisense
Sep 30, 2011 04:05 PM|LINK
Hi,
thanks for your quickly reply.
It is not enough. I try to explain.
Whit the code you suggested, if I include my user control in a page and if I I start to type: 'Title', the intellisense suggest me all the value allowed for that property but it is not the goal.
I would have the following situation. Consider the example showed in the Link1, when I add the control in the page and when I a start to type MessageTemplate and close the tag, then I would receive fron the intellisense some allowed value for MessageTemplate node and I would customize this kind of allowed values.
Example:
It is not easy to explain, I can give you an example of a library that include some controls with this behaviour (Ext .NET www.ext.net). If you see the example Editable Grid Panel (http://examples.ext.net/#/GridPanel/Editable/Editor_with_DirectMethod/), you can see that for the component
<ext:GridPanel...
you can have the properties Listener like this
that is the goal.
I hope it is more clear now.
Many thanks
cts-mgraham
Contributor
3318 Points
642 Posts
Microsoft
Re: User Control Properties Intellisense
Oct 03, 2011 10:56 AM|LINK
I'm afraid I don't have any samples of this, and perhaps you can check with our All-In One Code Framework site - that is a good place to go to ask for samples such as this.
jkirkerx
Contributor
3750 Points
873 Posts
Re: User Control Properties Intellisense
Oct 05, 2011 04:02 AM|LINK
http://forums.asp.net/t/1586148.aspx/1?ASP+NET+Designer+How+Do+I+generate+this+Design+Time+Markup+
I think it's called a control collection, I forget, but I know what your talking about. There are very few examples on the subject.