tags:

views:

913

answers:

4

I would like to add some paragraphs or new lines or words dynamically but I want to make gaps between every part and the other. How is it possible to do that in the c# code page?

+1  A: 

You can use LiteralControl to add HTML tags like that :

Page.Controls.Add(new LiteralControl("<p>New<br />Line</p>"));
Canavar
Note that this will just add the control to the page. If you want some control over where the literal will appear you can set the 'runat' property of a div. Then in your code behind use clientDivId.Controls.Add(new LiteralControl("html here"));
Chalkey
oh +1 by the way :)
Chalkey
Yes, you're right, I generally use a placeholder for that.
Canavar
A: 

Ideally, you don't want to add markup code to your codebehind pages. But if you must, you can perhaps use HTML's <p> element to make different paragraphs. By default, each paragraph has some top and bottom margin to separate it from other elements on the page.

Daan
A: 

You can do this using HttpModule. HttpModule can intercept request and response and modify as you need.

this. __curious_geek
A: 

Maybe this is the proper way: http://msdn.microsoft.com/en-us/library/620b4fzf(VS.71).aspx

So if you like to add what a paragraph with a break inside:

HtmlGenericControl paragraph = new HtmlGenericControl("p");
paragraph.Controls.Add(new HtmlGenericControl("br"));
Page.Controls.Add(paragraph );
misnyo