Reputation:
I need a listview that adapts to the datasource and dynamically creates textbox controls.
Background: I upload an excel file, convert it to a datatable, display the values that were uploaded, allow for editing via textboxes, then finally insert it into a database.
The datasource will always be a datatable, but the number of columns will vary based on the excel file. Any help would be appreciated.
Upvotes: 0
Views: 561
Reputation: 2487
You could try to use a DataGrid.
In Windows Forms:
dataGrid.DataSource = yourDataTable;
In WPF:
dataGrid.ItemsSource = yourDataTable.AsEnumerable();
Upvotes: 0
Reputation: 13600
This is not possible with regular listview control. Well, at least I don't know about such possibility. I'm afraid you need to create a control yourself which will meet your requirements.
Upvotes: 2