ListView binding to DataTable...
I have a DataTable with three columns (Name, CasesToday, CasesWeek) and a ListView with a View of GridView. I need to bind the ListView to display the contents of the DataTable at runtime. I have tried gvUsers.ItemsSource = dtUsers2.DefaultView; but this only shows "System.Data...." and not the actual value from the row. I have scoured the Internet for the solution to this but can only find SQL and XML binding; none the reference DataTables. Any help would be much appreciated.

Sam HobbsRank #107 · 20.5K reputationPosted Nov 5, 2009, 8:03 AM EST
Look at the Data Walkthroughs to see what can be done. You don't need to do the walkthroughs in any order; do the ones you want to in the order you want to. Most of the walkthroughs use the DataGridView, which is like a ListView, but the general concepts are the same for both. My guess is that you will decide to use a DataGridView instead.
romelevans16 reputationPosted Nov 5, 2009, 2:37 PM EST
Amit ChoudharyRank #145 · 15.8K reputationPosted Nov 5, 2009, 7:43 PM EST
and in the codebehind bind like this ListView1.DataSource=Dtable; ListView1.DataBind();
Sam HobbsRank #107 · 20.5K reputationPosted Nov 6, 2009, 7:47 AM EST
ListView1.DataSource = dt;
Where dt is the DataTable.
Joseph17 reputationPosted Nov 6, 2009, 8:09 AM EST
Sam HobbsRank #107 · 20.5K reputationPosted Nov 6, 2009, 8:49 AM EST