How can we setting sort order in RDLC via C# code? (without report designer)

时间:2015-10-06 08:51:20

标签: c# asp.net asp.net-mvc sorting rdlc

I'm currently working on a ASP.net MVC project and using RDLC Report to generate excel file.

How can we setting sort order (ASC or DESC) in RDLC via C# code? (without report designer).

I know how to setting sort column dynamically by Report Parameter, but I cannot find how to setting sort order by report parameter.

Can anyone guide me?

Thank you.

1 个答案:

答案 0 :(得分:0)

我不确定我的回答是否会对您有所帮助,但是无论如何我都会将其付清。我尝试了几行即时通讯使用Lambda的地方,并假设它即使在您的情况下也适用。 var productQuery = (from product in unitOfWork.Repository<Product>().Table select product).AsQueryable(); If (productName == "Vehicle") {productQuery = productQuery.Where(a=>a.ProductStatus != "New" && a.ProductNumber !=null).OrderByDescending(a=>a.ProductNumber).AsQueryable(); };