Click here to Skip to main content
12,953,230 members (64,969 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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 5: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
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2017
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