practice email practice email - 2 months ago 5
ASP.NET (C#) Question

how to get values from arraylist to Textbox

ArrayList myArrayList = new ArrayList();
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
for (int j = 0; j <= dt.Columns.Count - 1; j++)
{
myArrayList.Add(dt.Rows[i][j].ToString());
}
}


i want to send a mail to all mail id's which i am storing in array list how to bind that total array list to a Textbox.

Answer

If I understand your question correctly, this code may help you

foreach(object item in myArrayList)
{
    TextBoxId.Text += item.ToString();
} 

Or you can forget your arrayList, populate TextBox directly while looping in table.

          for (int i = 0; i <= dt.Rows.Count - 1; i++)
                 {
                     for (int j = 0; j <= dt.Columns.Count - 1; j++)
                     {
                         //myArrayList.Add(dt.Rows[i][j].ToString());
                         TextBoxId.Text += dt.Rows[i][j].ToString();
                     }
                 }