W
W Akthar
Hi,
Is there a way to insert items into a datagrid
individually instead of using datasource and databind??
For example:
I have a collection of people,
I want to be able to iterate through this collection and
insert particular items into a datagrid.
namesCollection = MyService.GetAllNames();
int i=0;
for (i=0;i<namesCollection.Count;i++)
{
Names item = namesCollection;
dgNames.Items.Cells[0].Text = item.ID.ToString
().TrimEnd();
dgNames.Items.Cells[1].Text =
item.Salutation.ToString().TrimEnd();
dgNames.Items.Cells[2].Text = item.Initial.
ToString().TrimEnd();
dgNames.Items.Cells[3].Text = item.ForeName.
ToString().TrimEnd();
dgNames.Items.Cells[4].Text = item.SurName.
ToString().TrimEnd();
}
This falls over because dgNames is out of range!!
Any ideas ???
Is there a way to insert items into a datagrid
individually instead of using datasource and databind??
For example:
I have a collection of people,
I want to be able to iterate through this collection and
insert particular items into a datagrid.
namesCollection = MyService.GetAllNames();
int i=0;
for (i=0;i<namesCollection.Count;i++)
{
Names item = namesCollection;
dgNames.Items.Cells[0].Text = item.ID.ToString
().TrimEnd();
dgNames.Items.Cells[1].Text =
item.Salutation.ToString().TrimEnd();
dgNames.Items.Cells[2].Text = item.Initial.
ToString().TrimEnd();
dgNames.Items.Cells[3].Text = item.ForeName.
ToString().TrimEnd();
dgNames.Items.Cells[4].Text = item.SurName.
ToString().TrimEnd();
}
This falls over because dgNames is out of range!!
Any ideas ???