I have found what I think is a bug in the Telerik MVC Grid control. I am using VS 2008 with MVC 2 and the Telerik 2010.1.416 build. I am running on Windows XP SP3 with all latest patches. I execute the following query to the database:
var predicate = PredicateBuilder.True<MvcQuerySystem.Models.Data.domain_models.adv_expenditure_model>(); |
predicate = predicate.And(o => o.spender.Equals("TUDOR CHRISTOPHER")); |
predicate = predicate.And(o => o.electionYear.Equals("2008")); |
IEnumerable<MvcQuerySystem.Models.Data.domain_models.adv_expenditure_model> advanced = |
(from c1 in c1s |
join c4 in c4s on new { c1.filer_id, c1.election_year } equals new { c4.filer_id, c4.election_year } |
join expn in expns on c4.repno equals expn.repno |
join report in reports on c4.repno equals report.repno |
where report.superseded == null && expn.date_paid != null |
orderby expn.amount descending, expn.name |
select new MvcQuerySystem.Models.Data.domain_models.adv_expenditure_model |
{ |
spender = c1.name, |
vendor = expn.name, |
date = (DateTime)expn.date_paid, |
amount = (decimal)expn.amount, |
city = expn.city, |
state = expn.state, |
zip = expn.zip4, |
description = expn.expn_desc, |
repno = (int)c4.repno, |
filer_id = c1.filer_id, |
electionYear = c1.election_year, |
}).Where(predicate); |
It works OK until I try to filter by state. When I do this, I get the following error:
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
Additional information: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The state column in the database is not required, and in some cases is null (in case that matters).
In LINQPad, I am able to add .Where(o => o.state.Equals("WA")) after .Where(predicate) without getting any errors, and I get the correct information returned.
Adding .Where(o => object.Equals("WA", o.state)) also works correctly in LINQPad, as does adding an additional predicate:
predicate = predicate.And(o => o.state.Equals("WA")) or predicate = predicate.And(o => o.state.Equals("WA"));