ttkalec1 Posted May 22, 2008 Posted May 22, 2008 Hi, I have an (I think) easy question. I have a situation where i have an array of strings like Dim Names as string() and this array doesn't always have the same number of strings in it. My problem is that i have to print that strings on to my aspx page but I obviously can't use label controls on my aspx form for this, cause I don't know how much strings will I have, so I can't populate my labels. I need to print these names in a list like this: Peter Bob Michael So, what control to use for this or how to print these names one below the other? Quote
ttkalec1 Posted May 22, 2008 Author Posted May 22, 2008 I found out the solution to my problem and It's really simple :D I need to have one label control and just put a text like this in it: label1.text = "Some text <br /> tekst in new line" and that solves my problem ;) Quote
Nate Bross Posted May 22, 2008 Posted May 22, 2008 You could also use an ArrayList object and the ListView object to display. [csharp] ArrayList strings = new ArrayList(3); strings.Add("MyString1"); strings.Add("MyString2"); strings.Add("MyString3"); {ListBox}.DataSource = strings; {ListBox}.DataBind(); [/csharp] This way, you will have the correct values displayed regardless of how many strings you have. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.