Reputation: 6405
I have a form f runat="server" to which I'm adding LinkButton controls at run-time.
foreach(string aLink in WordList)
{
LinkButton lb = new LinkButton();
lb.ID = aLink;
lb.Text = aLink;
f.Controls.Add(lb);
}
The result is all links on a single line going way, way off the screen. This is all with default styling. Tried with Chrome and IE with the same results.
Is there something special that needs to be done to dynamic LinkButton controls to make the resulting anchors wrap?
Upvotes: 0
Views: 173
Reputation: 318
Add a space between each item. If it is in a HTML table, make sure you don't have "nowrap" in the <TD>
.
Upvotes: 1
Reputation: 55419
Add a space between each link:
// after adding lb:
f.Controls.Add(new LiteralControl(" "));
Upvotes: 2