Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP:NET
hi guys,
 

i have an arraylist. i have a , under
i want to print the value of array list by using a loop how can i do this please provide some help.
Posted 25-Sep-12 6:56am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi ,
Check this
 
<div>
    <asp:Table ID="Table1" runat="server">
    </asp:Table>
</div>
    protected void Page_Load(object sender, EventArgs e)
    {
        string[] test = new string[] { "test", "test2", "test3", "test4" };
        foreach (string item in test)
        {
            TableRow tr = new TableRow();
            TableCell tc = new TableCell();
            tc.Text = item;
            tr.Controls.Add(tc);
            Table1.Controls.Add(tr);
        }
    }
Best regards
M.Mitwalli
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Did not get your question what exactly you are looking for…
But if I am not wrong, following is your solution
Public void ReadArrayList(ArrayList list)
    {
	foreach (int i in list)
	{
	    Console.WriteLine(i);
	}
    }
OR
foreach (ArrayList item in arrList) 
 {
               Fields["KOD"].Value = item[0];
               Fields["DESC"].Value = item[7];
               Fields["QTY"].Value = Convert.ToInt32(item[1]);
               Fields["PRICE"].Value = Convert.ToDouble(item[3]);
...
 }
  Permalink  
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 495
1 Maciej Los 258
2 OriginalGriff 229
3 BillWoodruff 170
4 Zoltán Zörgő 165
0 OriginalGriff 7,934
1 DamithSL 6,084
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,174
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100