Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ListOfProducts
- {
- [DataMember()]
- public List<Product> ProductList { get; set; }
- public ListOfProducts()
- {
- ProductList = new List<Product>();
- }
- }
- public ListOfProducts GetObject()
- {
- ListOfProducts Listproducts = new ListOfProducts();
- ........
- using (IDataReader reader = cmd.ExecuteReader())
- {
- while (reader.Read())
- {
- Product product = new Product(reader["Name"].ToString(), reader["Code"].ToString());
- Listproducts.ProductList.Add(product);
- }
- }
- return Listproducts;
- }
- void service_GetObjectCompleted(object sender, GetObjectCompletedEventArgs e)
- {
- if (e.Result.Count != 0) //throws NullReferenceException
- {
- PagedCollectionView pagingCollection = new PagedCollectionView(e.Result);
- pgrProductGrids.Source = pagingCollection;
- grdProductGrid.ItemsSource = pagingCollection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement