Error adding header to datagrid

M

mcrowell

Here's my code:

DataGridItem row = new DataGridItem(-1, -1, ListItemType.Separator);
TableCell cell = new TableCell();
row.Cells.Add(cell);
cell = new TableCell();
cell.Text = "New Header";
row.Cells.Add(cell);
cell = new TableCell();
row.Cells.Add(cell);
dgSites.Controls[0].Controls.Add(row);

I get the following error:

Specified argument was out of the range of valid values. Parameter
name: index

Line 432: dgSites.Controls[0].Controls.Add(row);

What's the problem here? Any help appreciated. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top