Internet Explorer lags w/ IQueryable datasource. Firefox and Chrome A-OK. Video proof supplied

I'd like to say it's the query, but it isn't. Even when we go through it step-by-step, the queries finish without a hitch. Even the .DataBind() method doesn't APPEAR to cause the lag.

Here's how I know it has to do with my IQueryable as the binding source:

Old code:

  1. Call a stored procedure using SqlCommand and use SqlAdapter to fill a new DataTable.
  2. The DataTable would be sent into a method for each DropDownList. (There are 5 DDLs)
  3. Each method would feed the rows of the DataTable (yes, each of them) into an IEnumerable.
  4. Multiple LINQ queries would be run against the IEnumerable to filter out the options we wanted, including a .Distinct(IEqualityComparer) and .Sort(x => x["RowName"]); (Again, each of the methods would perform this).
  5. A new DataTable would be created via IEnumerable.CopyToDataTable() (Yes, again, each method)
  6. The DropDownList.DataSource would be set to the new DataTable, and would then .DataBind().

This horrible travesty of a code would finish very quickly in IE. Perhaps a second or two of think time.

Here's the new code, in the flesh:

IQueryable<Expose_LotRuns> elr = DB.Expose_LotRuns; if (iTechID > 0) elr = elr.Where(x => x.Master_LotRuns.Flows.CD_Techs.ID == iTechID); if (iFlowID > 0) elr = elr.Where(x => x.Master_LotRuns.Flows.ID == iFlowID); if (iToolID > 0) elr = elr.Where(x => x.Master_LotRuns.Tools.ID == iToolID); if (iOperationID > 0) elr = elr.Where(x => x.Master_LotRuns.Operations.ID == iOperationID); if (iReticleID > 0) elr = elr.Where(x => x.Reticles.ID == iReticleID); var techs = from x in elr where (x.Master_LotRuns.Flows.CD_Techs != null) group x by new { x.Master_LotRuns.Flows.CD_Techs.ID, x.Master_LotRuns.Flows.CD_Techs.Technology } into y orderby y.Key.Technology select new { y.Key.ID, y.Key.Technology }; var flows = from x in elr //where (x.Master_LotRuns.Flows != null) group x by new { x.Master_LotRuns.Flows.ID, x.Master_LotRuns.Flows.Flow } into y orderby y.Key.Flow select new { y.Key.ID, y.Key.Flow }; var tools = from x in elr //where (x.Master_LotRuns.Tools != null) group x by new { x.Master_LotRuns.Tools.ID, x.Master_LotRuns.Tools.Tool } into y orderby y.Key.Tool select new { y.Key.ID, y.Key.Tool }; var ops = from x in elr //where (x.Master_LotRuns.Operations != null) group x by new { x.Master_LotRuns.Operations.ID, x.Master_LotRuns.Operations.Operation } into y orderby y.Key.Operation select new { y.Key.ID, y.Key.Operation }; var rets = from x in elr //where (x.Reticles != null) group x by new { x.Reticles.ID, x.Reticles.Reticle } into y orderby y.Key.Reticle select new { y.Key.ID, y.Key.Reticle }; ddlTechs.DataTextField = "Technology"; ddlTechs.DataValueField = "ID"; ddlTechs.DataSource = techs; ddlTechs.DataBind(); ddlTechs.Items.Insert(0, new ListItem("Any", "0")); ddlFlows.DataTextField = "Flow"; ddlFlows.DataValueField = "ID"; ddlFlows.DataSource = flows; ddlFlows.DataBind(); ddlFlows.Items.Insert(0, new ListItem("Any", "0")); ddlTools.DataTextField = "Tool"; ddlTools.DataValueField = "ID"; ddlTools.DataSource = tools; ddlTools.DataBind(); ddlTools.Items.Insert(0, new ListItem("Any", "0")); ddlOpers.DataTextField = "Operation"; ddlOpers.DataValueField = "ID"; ddlOpers.DataSource = ops; ddlOpers.DataBind(); ddlOpers.Items.Insert(0, new ListItem("Any", "0")); ddlReticles.DataTextField = "Reticle"; ddlReticles.DataValueField = "ID"; ddlReticles.DataSource = rets; ddlReticles.DataBind(); ddlReticles.Items.Insert(0, new ListItem("Any", "0"));

Now, if you'll watch the following video, you'll see that the code above works very well in both Firefox and Chrome, and yet it blows in MS IE. Normally I'd be happy with it because I don't use IE, but IE is company policy. It's also worth mentioning that the lag only happens for the FIRST DDL, but not any of the subsequent selections. Also, the initial load (which loads all data, not limited at all, using the same methods) does not take this long to load either.

Some please, PLEASE tell me why IE behaves like this, and what I can do to fix it. BTW, it works just as badly in IE7 and IE8

-------------Problems Reply------------

First off, there is nothing wrong in the code you've included in the question in this context as it doesn't run in IE. It has to do with the ASP.NET UpdatePanel postback code which sometimes has issues in IE particularly with dropdowns with many rows. See this.

To debug issues like this, you can attach a Profiler (IE8 has one) and see which function is taking a long time to execute. If you also attach a network monitor such as HTTPWatch or Fiddler, you can find out how much time the server is taking to respond. In this case, I highly doubt the server time is the problem.

The other posted user is correct, and how another Stack Overflow answer solved a problem with this in Internet Explorer.

Category:c# Views:0 Time:2010-01-18

Related post

Copyright (C), All Rights Reserved.

processed in 0.270 (s). 11 q(s)