blah blah blah is here! blah blah » Close

up0down
link

On one of my pages I'm creating, i'm dynamically creating Web Controls and adding them to the Controls collection of a Panel on my page at run time based on the rows in a datareader object.
How can I set a line break on the panel after the last control for each datarow is created...?

last answered 2 years ago

1 answers

up0down
link

Add a Literal control at the end of each datarow. What you put in that Literal control depends on how you define line break. Hope this helps ;)

up0down
link

Not sure what you mean by Literal Control, and by line break I mean achieving the equivelent of an HTML <BR> tag, so for each datarow I'm starting my dynamic controls collection on a new line...

up0down
link

Hi Rhys,
I see what you mean. You can use the Literal control to do this. I ran a little test on my machine just to make sure. ;)
<code>
Literal lit = new Literal();
lit.Text = "
";
Panel1.Controls.Add(lit);
</code>

up0down
link

Just the ticket, works as requested!
:)
rhys

This post was imported from csharpfriends, if you have a similiar question please ask it again.

All previous members have been migrated, hope you enjoy the new platform!

Feedback