line break in link button's text

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top