, , , , . :
:
from cust in Customers
where cust.City == "London"
select cust;
If you want to dynamically change Lquery, not cust.City == "London", to cust.Street == "London". You should use the if-else statement as follows:
var lquery = (from cust in Customers
where cust.City == "London"
select cust).ToList();
if(true){
lquery = (from cust in Customers
where cust.Street == "London"
select cust).ToList();
}
GridView.DataSource = lquery;
GridView.Databind();
The code above is longer than your code, but it can satisfy your theme. In my project, I still use this code because it does not delay my program, but it executes my current problem.
source
share