Hello everyone,
After bind listview with linq query, occuring error.
how can I solve this error ? Unable to cast object of type 'Grouping[System.String,<>
- public UC_ArcMgmt()
- {
- InitializeComponent();
- DMSBusinessLayer service = new DMSBusinessLayer();
- listView1.ItemsSource = service.GetArchivedList().SelectMany((x) => new[] { new { Id = x.Id, ArchievedName = x.ArchievedName, UpdatedDate = x.UpdatedDate, FileSize = FormatBytes(x.fsize), docCount = x.docCount } }).Distinct()
- GroupBy((x) => x.ArchievedName);
- }
- private void btn_Click(object sender, MouseButtonEventArgs e)
- {
- foreach (Tble_Documents item in listView1.SelectedItems) /*here showing error*/
- {
- int DocId = Convert.ToInt32(item.Id);
- }
- }

Amit GuptaPosted Jan 2, 2017, 4:47 AM
Abhilash J APosted Jan 2, 2017, 4:08 AM
Amit GuptaPosted Jan 2, 2017, 3:55 AM
Abhilash J APosted Jan 1, 2017, 9:03 PM
Amit GuptaPosted Jan 1, 2017, 1:40 PM