Prev: printing a gridview's contents
Next: Nested ListView
From: Puja Parekh on 28 Mar 2010 22:53 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 = ", "; if (i < ds.Tables[0].Rows.Count - 1) Panel1.Controls.Add(ltl); } Thanks puja
From: Alexey Smirnov on 29 Mar 2010 10:45 On Mar 29, 4:53 am, "Puja Parekh" <parekhpu...(a)gmail.com> wrote: > 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 = ", "; > > 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
|
Pages: 1 Prev: printing a gridview's contents Next: Nested ListView |