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
2009-07-03 11:29:27
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
2009-07-03 11:50:29
oh +1 by the way :)
Chalkey
2009-07-03 11:51:05
Yes, you're right, I generally use a placeholder for that.
Canavar
2009-07-03 12:09:18
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
2009-07-03 11:30:40
A:
You can do this using HttpModule. HttpModule can intercept request and response and modify as you need.
this. __curious_geek
2009-07-03 11:34:58
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
2009-07-03 11:37:52