line break in link button's text

  • Thread starter Thread starter Puja Parekh
  • Start date Start date
P

Puja Parekh

hi all,

i have an aspx page and its got one panel.

now am creating link buttons dynamically and adding it to a panel. When I
run, it shows all link buttons in 2-3 lines in a panel which is how i want
to display

now my problem is i want to display link button's text and the current time
below it as a whole link, when i do sth like linkButton.Text = "LinkButton 1
<br/> " + DateTime.Now.ToString(); , I loose them displaying all in 2-3
lines. Below is my code and its not displaying the button how i want them

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

{

LinkButton lnkButton = new LinkButton();

lnkButton.ID = "lnkButton" + i;

lnkButton.Text = "LinkButton" + i.ToString() + "<br/>" +
DateTime.Now.ToString();

lnkButton.Font.Bold = true;

lnkButton.Font.Name = "Arial";Panel1.Controls.Add(lnkButton);

Literal ltl = new Literal();

ltl.Text = ",&nbsp;&nbsp;";

if (i < ds.Tables[0].Rows.Count - 1)

Panel1.Controls.Add(ltl);

}

Thanks
puja
 
hi all,

i have an aspx page and its got one panel.

now am creating link buttons dynamically and adding it to a panel. When I
run, it shows all link buttons in 2-3 lines in a panel which is how i want
to display

now my problem is i want to display link button's text and the current time
below it as a whole link, when i do sth like linkButton.Text = "LinkButton 1
<br/> " + DateTime.Now.ToString(); , I loose them displaying all in 2-3
lines. Below is my code and its not displaying the button how i want them

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

{

LinkButton lnkButton = new LinkButton();

lnkButton.ID = "lnkButton" + i;

lnkButton.Text = "LinkButton" + i.ToString() + "<br/>" +
DateTime.Now.ToString();

lnkButton.Font.Bold = true;

lnkButton.Font.Name = "Arial";Panel1.Controls.Add(lnkButton);

Literal ltl = new Literal();

ltl.Text = ",&nbsp;&nbsp;";

if (i < ds.Tables[0].Rows.Count - 1)

Panel1.Controls.Add(ltl);

}

Thanks
puja

You can try to do this using CSS style as described below
http://forums.asp.net/p/1075982/1804219.aspx

Hope this helps
 
Back
Top