Custom controls and innerHTML

F

Frédéric Mayot

Hi,
I would like to create a custom control to encapsulate my header, footer and
menu (a kind of frameset).
So, in my aspx page, I would like to write something like this:
<cc:Frameset>
<h1>something</h1>
<a ...>
<table>
...
</table>
</cc:Frameset>

I don't want to create a property because I'll need to write my HTML code
between double quotes.
A user control is not appropriated because I'll need to reuse this frameset
in several web applications.
What is the best thing to do ? Can I do what I want ?

Thanks.
Fred
 
M

MattC

You could just derive your custom control from the PanelControl.

public class MyContainer : System.Web.UI.WebControls.Panel

Then Override the RenderChildren method:

protected override void RenderChildren(HtmlTextWriter writer)
{
writer.write("<table><tr><td>foo</td><tr><td>\n"); //header

base.RenderChildren(writer);

writer.write("</td></tr><tr><td>bar</td></tr></table>\n"); //footer
}

MattC
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top