I'm sure this is a simple one, but I can find the answer. To bring my Custom Server Control skills up-to-date, I'm creating a tab control just for the fun of it. I've been able to get a child tag to render in IntelliSense:
i.e.
<CS:TabControl>
<Tab />
</CS:TabControl>
However, I only want IntelliSense to show Tab as an option between the opening and closing CS:TabControl tags and only allow all other server/other controls to show up/be placed inside the Tab tags. Is there an attribute or
something I need to set for that? Also, what is the attribute or something else that I have to do to get the default behavior of Tab to be rendered as <Tab></Tab> instead of <Tab /> in HTML view?
Tools>Options>Text Editor>HTML>Format>Tag Specific Options.
I'm looking more for the default behavior of the tag. For instance, if I start typing the Tab tag, but then type >, I want it to auto-complete it as <Tab></Tab> instead of <Tab />. I've seen some server controls do that, which
makes me arrive at the conclusion that this is an attribute or some other thing that I set in code to get that behavior.
Hi,
In the below case i am asuming that you are treating inner contents of TabControl as properties rather than child controls.you need to apply different attriute if you want to treat inner contents as chld controls. like
[PersistChildren(true)]. I assumed inner contents of tab control would be controls.
Apply [PersistenceMode(PersistenceMode.InnerProperty)] attribute to Tab property in TabControl Class. With this you can acheive first task..you can find only <tab> control in the intellesence.
For Tab Control
[PersistChildren(true)]
[ParseChildren(false)]
public class Tab : System.Web.UI.Control
{
}
}.
Thanks,
KKK
Don't forget to click "Mark as Answer" on the post that helped you.
In the below case i am asuming that you are treating inner contents of TabControl as properties rather than child controls.you need to apply different attriute if you want to treat inner contents as chld controls. like
[PersistChildren(true)]. I assumed inner contents of tab control would be controls.
Apply [PersistenceMode(PersistenceMode.InnerProperty)] attribute to Tab property in TabControl Class. With this you can acheive first task..you can find only <tab> control in the intellesence.
Hi,
As it is, I have Tab as a property with the [PeristenceMode(PersistenceMode.InnerProperty)] attribute. I'll give the other stuff your recomended a shot. Thanks.
StrongTypes
All-Star
30801 Points
6013 Posts
ASPInsiders
Prevent tags withing an element
Mar 06, 2006 01:31 PM|LINK
I'm sure this is a simple one, but I can find the answer. To bring my Custom Server Control skills up-to-date, I'm creating a tab control just for the fun of it. I've been able to get a child tag to render in IntelliSense:
i.e.
<CS:TabControl>
<Tab />
</CS:TabControl>
However, I only want IntelliSense to show Tab as an option between the opening and closing CS:TabControl tags and only allow all other server/other controls to show up/be placed inside the Tab tags. Is there an attribute or something I need to set for that? Also, what is the attribute or something else that I have to do to get the default behavior of Tab to be rendered as <Tab></Tab> instead of <Tab /> in HTML view?
Thanks
llangleyben
Star
8315 Points
1660 Posts
MVP
Re: Prevent tags withing an element
Mar 06, 2006 02:36 PM|LINK
Hi,
If you are working in vs2005:
Tools>Options>Text Editor>HTML>Format>Tag Specific Options...
Let me know if this is what you need
MCSD, ASP.NET MVP
Blog
StrongTypes
All-Star
30801 Points
6013 Posts
ASPInsiders
Re: Prevent tags withing an element
Mar 06, 2006 02:40 PM|LINK
I'm looking more for the default behavior of the tag. For instance, if I start typing the Tab tag, but then type >, I want it to auto-complete it as <Tab></Tab> instead of <Tab />. I've seen some server controls do that, which makes me arrive at the conclusion that this is an attribute or some other thing that I set in code to get that behavior.
Thanks.
kalvagadda
Participant
1513 Points
281 Posts
Re: Prevent tags withing an element
Mar 06, 2006 05:19 PM|LINK
In the below case i am asuming that you are treating inner contents of TabControl as properties rather than child controls.you need to apply different attriute if you want to treat inner contents as chld controls. like [PersistChildren(true)]. I assumed inner contents of tab control would be controls.
Apply [PersistenceMode(PersistenceMode.InnerProperty)] attribute to Tab property in TabControl Class. With this you can acheive first task..you can find only <tab> control in the intellesence.
For Tab Control
[PersistChildren(true)]
[ParseChildren(false)]
public class Tab : System.Web.UI.Control
{
}
}.
Thanks,
KKK
StrongTypes
All-Star
30801 Points
6013 Posts
ASPInsiders
Re: Prevent tags withing an element
Mar 06, 2006 05:41 PM|LINK
Hi,
As it is, I have Tab as a property with the [PeristenceMode(PersistenceMode.InnerProperty)] attribute. I'll give the other stuff your recomended a shot. Thanks.