Nested controls in custom tab control

  • Thread starter Marius Trælnes
  • Start date
M

Marius Trælnes

Hello!

I am about to make a class/control that creates tabbing functionality. The
result is in HTML/CSS/JavaScript output.

My question is: Within the tabs I want to simply add user controls and
without loosing viewstate etc etc. How can this be done? What is best
practice?

I guess the answer for my question lies in how I design/develop the tab
class/control. One solutions might simply to have a placeholder created for
each tab (and then the usercontrol to be in that tab added to the
placeholder).

Any comments/suggestions appreciated.

Marius
 
F

Franck Quintana

Hi,

My suggestion is the next.
I think a tabbed control is "just" a serie of labels displayed in a peculiar
way.
That is to say, a tabbed control can be composed of

<ul><li>tab1</li><li>tab2</li><li>tab3</li></ul> (this example was the
choice of Scott Watermasysk http://www.scottwater.com)

After that, you must specify styles for each tag (this is the hard work) and
create a style for selected tab if you want to handle a persistable
seletected tab or when the mouse pointer hovers it.

I suggest you to take a look at scott site because i think it's a very good
example of how to use css.

Hope this helps!
Regards,
Franck Quintana
Active+ Software
http://www.activeplus.com


| Hello!
|
| I am about to make a class/control that creates tabbing functionality. The
| result is in HTML/CSS/JavaScript output.
|
| My question is: Within the tabs I want to simply add user controls and
| without loosing viewstate etc etc. How can this be done? What is best
| practice?
|
| I guess the answer for my question lies in how I design/develop the tab
| class/control. One solutions might simply to have a placeholder created
for
| each tab (and then the usercontrol to be in that tab added to the
| placeholder).
|
| Any comments/suggestions appreciated.
|
| Marius
|
|
 
M

Marius Trælnes

Hello Franck,

This was not an answer to my question. How to make the tab control i know. I
asked about how to add existing user controls into the custom tab control.
Forget the tab control if that is confusing. How to add existing user
controls into some dynamic generated html then. What is the best approach?

Thanks for trying though...

Marius
 
B

bruce barker

just add them to your Controls collection (and render your children). you do
no need a placeholder, because your tab control can be placed on the form.

-- bruce (sqlwork.com)


| Hello Franck,
|
| This was not an answer to my question. How to make the tab control i know.
I
| asked about how to add existing user controls into the custom tab control.
| Forget the tab control if that is confusing. How to add existing user
| controls into some dynamic generated html then. What is the best approach?
|
| Thanks for trying though...
|
| Marius
|
| | > Hi,
| >
| > My suggestion is the next.
| > I think a tabbed control is "just" a serie of labels displayed in a
| peculiar
| > way.
| > That is to say, a tabbed control can be composed of
| >
| > <ul><li>tab1</li><li>tab2</li><li>tab3</li></ul> (this example was the
| > choice of Scott Watermasysk http://www.scottwater.com)
| >
| > After that, you must specify styles for each tag (this is the hard work)
| and
| > create a style for selected tab if you want to handle a persistable
| > seletected tab or when the mouse pointer hovers it.
| >
| > I suggest you to take a look at scott site because i think it's a very
| good
| > example of how to use css.
| >
| > Hope this helps!
| > Regards,
| > Franck Quintana
| > Active+ Software
| > http://www.activeplus.com
| >
| >
| > | > | Hello!
| > |
| > | I am about to make a class/control that creates tabbing functionality.
| The
| > | result is in HTML/CSS/JavaScript output.
| > |
| > | My question is: Within the tabs I want to simply add user controls and
| > | without loosing viewstate etc etc. How can this be done? What is best
| > | practice?
| > |
| > | I guess the answer for my question lies in how I design/develop the
tab
| > | class/control. One solutions might simply to have a placeholder
created
| > for
| > | each tab (and then the usercontrol to be in that tab added to the
| > | placeholder).
| > |
| > | Any comments/suggestions appreciated.
| > |
| > | Marius
| > |
| > |
| >
|
|
 
H

Henrik Larsen

Ok, thank you for your tip. I still cannot see how this can be done without
placdholder (problably since I have only used that before).

Here is description of how I think this could be solved and my doubts:

1. A tab user control is made. There is some codebehind code there to create
correct client code (html/css/javascript). On each tab in that control there
should be possible to add other user controls (based on some properties to
be set when creating the user control).
2. This tab user control is placed on a web form (id = tabctrl1) and
"tab1Control" property is set to "testctrl.ascx".
3. At runtime the tab user controls then add the control "testctrl.ascx" in
the area of tab1. Here is doubt, and here are the approach I can think of:
Using control collection I can add the control as follows:
tabctrl1.Controls.Add(LoadControl("testctrl.ascx")). But here are 1 problem:
How to place this correct in the tab controls html output (here is a lot of
html/css/javascript created dynamically...). Here I only see that this can
be done by placing a placeholder where tab1 area is (or a panel control
could also to the work...)

Please let me know if I am missing something.

(of course, if I knew upfront what controls should be in each tab none of
this would be a problem, it is that it should be dynamically loaded that is
the "problem")

Marius
 

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,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top