Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- query = query.OrderBy(x => x."ProductId");
- System.Reflection.PropertyInfo prop = typeof(YourType).GetProperty("PropertyName");
- query = query.OrderBy(x => prop.GetValue(x, null));
- PropertyDescriptor prop = TypeDescriptor.GetProperties(typeof(YourType)).Find("PropertyName");
- query = query.OrderBy(x => prop.GetValue(x));
- query = query.OrderBy(x => x.GetType().GetProperty("ProductId").GetValue(x, null));
- typeof(YourType).GetProperty("ProductId").GetValue(theInstance);
- query = query.OrderBy(x => x.GetType().GetProperty("ProductId").GetValue(x, null));
- if (sortBy == "ProductId")
- query.OrderBy(x => x.ProductId);
- else
- query.OrderBy(x => x.ProductName);
Add Comment
Please, Sign In to add comment