Web user controls

B

Ben

Hi, I would like to use web user contols for header and footer controls.
The problem I'm having is that we're using tables for layout. (thanks for
any pro css solutions, but thats' a different thread :))

So in the header I want to output say..

<table><tr><td><script src="foo.js"></script></td><td>

Only if the page requires the menu, otherwise, none of that html should be
sent... I can set the property to determine if the data should be sent,
but i'm using response.write, that's putting the html at the top of the
page. :( How can I specify where in the user control to send the html?

Someone suggested adding a literal control, but would that add the </table>
also? I really want my content in the page and the </table> in the footer
control. Also, is it possible to have the user control add a stylesheet to
the page?

TIA,
Ben
 
I

Ireney Berezniak

First of all, placing all page content in one single table is just not a
good idea, in my opinion. This requires that browser generates the
whole table before rendering it ... which will give an impression of
slower page load, especially when you nest more tables in your layout,
or clients are old and slow.

You could easily create a 3 table layout. One for header, one of
content and the final one for footer. This way, you can easily manage
the header by placing markup it it's own control and display it or hide
it using <control>.Visible property, for instance.

You could use the literal control, sure. Just write the HTML code you
want to it ... ugly, but it should work.

You could also convert the table or it's elements into server side
controls and control visibility on the server side. For instance:

<table><tr id="MenuRow" runat="server"><td><script
src="foo.js"></script></td></tr>

Then on your prerender event, set MenuRow.Visibile = false

I'm not really sure what you are trying to accomplish here ... there are
a number of ways to write a piece of HTML to a particular spot on the
page. It would help to see the actual table layout and some of it's key
contents. However, if you must use tables for layout, don't use just
one ...

And you can certainly use a control to add a stylesheet to a page.

ib.
 

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,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top