Creating a panel with a collection property -- NEED HELP

N

Nicolas LeBlanc

Hello everybody,

I've been working lately on making my own tabstrip control because I couldn't find anything that works the way I want it. But now I have a problem, because I have a "Tabs" property which is the collection of tabs inside my control, I'm no longer able to add controls inside the panel...

So basically I have

<cc1:TabStrip properties>
<Tabs>
<Tab1 properties></Tab1>
...
</Tabs>
</cc1:TabStrip>

But with a normal panel, you can add whatever you want inside the panel (controls, etc)... but now I can't, if I try to add <asp:LinkButton id=...></asp:LinkButton> it will tell me that there are no property called "asp:LinkButton"...

Now I'm seriously pissed because it's thing left to finish my control, I want to add WebUserControl inside the pannel and make them visible or not when a tab is clicked.

The reason why I simply don't use another panel and work on it directly on the page is because I'm not using a plain panel, I'm using one of my owned which is boxed.. so you have the tabs, the box and controls will show up in the box...

But that doesn't work because of the properties.

Any help is appreciated.
 
W

Wilco Bauwer

If you really want to be able to add any kind of control to the Tabs
property, then you could change the Tabs' type to ControlCollection.
This means that you will have to create a Tab control which represents
a tab inside the tabstrip.

Then again, I think it would probably be nicer to change the type of
Tabs to TabControlCollection, a custom collection which derives from
ControlCollection and only takes Tab controls. You could then only add
controls which are a Tab. To be able to add custom controls, you could
for example create a custom Tab implementation which wouldn't render
anything, except its children.
 
N

Nicolas LeBlanc

Well, I just found a way to trick this.

I declared a PlaceHolder property in my control, and I can put whatver I
want in it.

<Holder>
.... controls
</Holder>

Works like a charm!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top