Insert controls into output HTML (DotNetNuke style)

J

John

I am trying to get a control to insert into the HTML content for a page
which comes from our database. At the point I have a tag for the component I
want to add which is contained inside the HTML. I have tried to insert the
control into a placeholder with no joy. I want to have something similar to
DotNetNukes way of adding content to a page.

Does anyone have any ideas how to do this or where I'm going wrong?

What I have so far : (there are no errors it just doesnt appear)

PlaceHolder LanguageBarPlaceHolder2;

protected void Page_Load(object sender, EventArgs e)

{

LanguageBarPlaceHolder2 = new PlaceHolder();

Literal1.Text = "<html><body><div>";

Literal1.Text += @"<asp:placeHolder ID=""LanguageBarPlaceHolder2""
runat=""server""></asp:placeHolder>";

Literal1.Text += "Test</div></html></body>";

LanguageBarPlaceHolder2.Controls.Add(LoadControl("~/Controls/LanguageBar.ascx"));

}
 
P

Patrick Steele

I am trying to get a control to insert into the HTML content for a page
which comes from our database. At the point I have a tag for the component I
want to add which is contained inside the HTML. I have tried to insert the
control into a placeholder with no joy. I want to have something similar to
DotNetNukes way of adding content to a page.

Does anyone have any ideas how to do this or where I'm going wrong?

What I have so far : (there are no errors it just doesnt appear)

PlaceHolder LanguageBarPlaceHolder2;

protected void Page_Load(object sender, EventArgs e)

{

LanguageBarPlaceHolder2 = new PlaceHolder();

Literal1.Text = "<html><body><div>";

Literal1.Text += @"<asp:placeHolder ID=""LanguageBarPlaceHolder2""
runat=""server""></asp:placeHolder>";

Literal1.Text += "Test</div></html></body>";

LanguageBarPlaceHolder2.Controls.Add(LoadControl("~/Controls/LanguageBar.ascx"));

}

I would try using the RenderControl method on the PlaceHolder control to
get it's content.
 

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

Top