Custom Controls to Create a Template

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
So I had a sort of template in my asp.net pages where I had a nav bar on the left, a header, and tables kept it all neat. I would copy this page out and add content. This worked great until, of course, I wanted to change something in the nav bar and I had to run around to 20 pages and make the same changes (my mom always said I learnt things the hard way).

Anyways, so I wised up and now I want to use user controls for the nav and header. My trouble is that it is sort of screwing the tables up now. Here is why: before I could just put the content right into the <td> but now that is encapsulated into the user control. So I thought maybe I would put a div on the page after adding the 2 user controls and then put the content in the div.

That works fine except when someone resizes the page or uses a different puter/monitor than me. See before the table was resizing nicely for me.

How do I overcome this?

I know that 2.0 has master pages or something like that but we aren't upgraded there yet. I ran into another issue like this when I tried to skin my site for different client, all the advice I got was, 'this is easy in 2.0'. Unfortunately I need to make this work at 1.1

Any suggestions?
 
I just had an idea! What if I could get the code behind to take the div and put it in the table at run time. Then the div could expand and contract as the table does. Would that work?
 
I have my usercontrol within a table..

can u put your usercontrol in a table and have width,height stuff set in it?
 
A website I'm currently working on (www.majikmotions.com) (upgrading) uses no tables...everything is div tags unless it was auto-generated by ASP, but since I have no repeater controls you will not find a table tag anywhere. The nav bar, header, and footer are all user controls, it displays fine across computers and browsers. Is this what you're trying to do? Not sure if I followed you.
 
I settled on this:

I have user controls that are niether divs nor tables, just html.
Then I have a 'template' page with the main table and the user controls stuck in it where I want. I copy this templated page out when I want to create a new page for my site.

So the answer for me was to put the user controls in a table rather than tables in the user control.

I really do like the idea of using divs instead of tables and I toyed with that first. But when the user resizes the browser the divs don't resize (or can they?). And if that doesn't work then what about folks with different sized monitors and different resolutions?
 
Back
Top