How do I add an item to a datagrid? I tried
dgList.Items.Add
but there is no Add function in the items list. How do I do it?
Please post code if you have it.
Printable View
How do I add an item to a datagrid? I tried
dgList.Items.Add
but there is no Add function in the items list. How do I do it?
Please post code if you have it.
You need to bind the datagrid to a datasource. For example, you could bind it to a Datatable object. The trick is to add you item to the underlying DataTable and then make a new call to YourDataGrid.DataBind().
That's the problem, I know how to bind a datasource or datatable, but I'm trying to add an item to a datagrid that already exists on the page. Is there a quick way to extract a datagrid into a datatable, so I can add the item, and rebind it?