.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Asynchronously Load LINQ Queries/Repeaters in Sections with Web Service

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net


I'm trying to  figure out the best way to load my main page faster.  What I'd like to do is have the bare bones of the master page display right away and on the Default.aspx Page_Load, call some web services that would query the rest of the items, in chunks, and then display.  I have 3 or 4 queries, which would be the chunks I am talking about. 

How would I accomplish this?  I tried putting Update Panels around the repeaters, but that didn't make the page show any faster, and the page still only displayed once all the data was queried.

I found this article, http://msdn.microsoft.com/en-us/library/2e08f6yc.aspx.  Could I call a web service and return a Linq Query and populate a Repeater on Default.aspx?  Would I need an Update Panel around the Repeater still?

I also found this article, which was very interesting in that it parsed and returned the actual HTML to plug into the page, http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/

I've been reading both of these for a while to try to understand which may be the best method to proceed with.  I'd really appreciate any a

View Complete Post

More Related Resource Links

Which tier do Linq queries belong?


Started in middle of a new project.  Our design architecture uses an n-tier (not MVC - no controllers) structure with Presentation, Data, Business and Service tiers.  However the lead analyst has the majoriety of code all in the Business tier claiming it all contains Business logic.  Our data tier is nothing more than a single .dbml model of the primary database to support all of the Linq queries in the Business tier.  To my mind Linq queries and classes they use are data access and belong in the data tier  but our lead analyst says they contain business logic therefore have to be in business layer.  

Data Points: LINQ Projection Queries and Alternatives in WCF Services


LINQ's ability to project randomly shaped data into anonymous types can be a blessing and a source of frustration, says Julie Lerman. It's great when you just need to grab a special view of your data, but it can be problematic in certain circumstances. She explains what the limitations are and how to get around them.

Julie Lerman

MSDN Magazine May 2010

Data Points: Precompiling LINQ Queries


Did you know that by precompiling LINQ queries you might actually be degrading your app's performance if you're not careful? Julie Lerman explains how to ensure you're not re-precompiling queries each time and losing the expected performance benefits across post-backs, short-lived service operations and other code where critical instances are going out of scope.

Julie Lerman

MSDN Magazine March 2010

Toolbox: Easy LINQ Queries, Becoming A Better Developer, And Logging Help


This month Toolbox provides help with error logging, finds an app that helps you write LINQ queries, and explores the non-technical side of development.

Scott Mitchell

MSDN Magazine September 2008

Parallel LINQ: Running Queries On Multi-Core Processors


Use Parallel Language Integrated Query (PLINQ) to take advantage of multi-processor computers and the newer wave of multi-core processors.

Joe Duffy and Ed Essey

MSDN Magazine October 2007

Time Difference in Linq queries


Hi All,


I have my Linq query in which i need to find time difference(not days difference).

The field in database is datetime.

Dim ldtToday As DateTime = TimeOfDay

Dim SR_RM_InnerJoin = From SR In lcntxRT60Entities.RtSReports _

Join RM In lcntxRT60Entities.RtRMaster On SR.RtRMaster.ReportID Equals RM.ReportID _

Select SR, RM _

Serializing Linq to Entities for use in a REST Service

What would be the best approach to send data retrieved from Linq to Entities over a rest service? For example, if you have a Linq to Entities class, say Products from the Northwind database. I want to return a subset of the Products (based on a query on the model) back through a service. First a retrieve a List<Product> from the context, and then i need to serialize the data and send it over the wire. If I use the exact Linq to Entities class, then there is so much "garbage" that it either fails outright (from a circular reference) or you are wasting bandwith. What is a design to overcome this? Create POCO objects for each linq to entities class you want to send and create custom code to tranform each object in the list to the POCO object? This is the only way I can see doing it, although it would be very tedius to create and maintain (unless some custom code generation was created). Is there a better approach? clients

Workflow Service failing on high load

Hi, I am load testing my workflow service to ensure that it can sustain high loads for a high volume transaction application. I am using Visual Studio's Load Test to run on a simple unit test to call the workflow service. I have configured the bindings on my service as follows:  <bindings>      <netTcpBinding>        <binding portSharingEnabled="true" closeTimeout="00:10:00"                 openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"                 maxBufferPoolSize="20480000" maxBufferSize="20480000" maxConnections="10"                  maxReceivedMessageSize="20480000"  >                    <security mode="None" />        </binding>      </netTcpBinding>  &n

How to load binary file asynchronously

I need to be able to download file from local disk or UNC path asynchronously. I've tried to use FileStream, but not sure what is the best way to read file by small chunks and combine them together then. Btw, does it make sense to download file by small chunks? Here is what I tried: byte[] _content; void Start(){ FileInfo fi = new FileInfo(path); if(fi.Exists) { FileStream fs = new FileStream(path, FileMode.Open); var stateObject = new State(fs, fi.Length); fs.BeginRead(stateObject.Buffer, 0, (int)stateObject.BufferSize, new AsyncCallback(EndReadCallback), stateObject); } } ... public void EndReadCallback(IAsyncResult asyncResult) { State state = (State)asyncResult.AsyncState; int readCount = state.FStream.EndRead(asyncResult); //store bytes inside class instance this._content = state.Buffer; //close stream state.FStream.Close(); if(FileLoaded != null) { FileLoaded.Invoke(_content); } } Thanks in advance, Paul.

Linq to SQL GroupBy with Nested Repeaters

Hello, After a few hours of searching I couldn't find a solution to this issue so I figured I'd try a post. I have stored procedure that queries 3 tables and retuns 1 set of results. When I execute the sproc using the following code  db.GET_TRAININGS(userID).GroupBy(s=>s.COURSE_TITLE);  I get back an IGrouping container where the course title is the key and contains 2 GET_TRAINING_RESULT elements. Then I bind using rptCourses.DataSource=trainings; then databind(),etc. What I'm trying to do is have the parent repeater show the course titles and the nested repeater show the modules for that course for the particular logged in user. Basically trying to turn a flat piece of data into heirchical data. The stored procedure returns the following SQL Columns Course_Title, Module_Path, Module_Name,Sequence. The sproc code is below: SELECT C.COURSE_TITLE, B.MODULE_PATH, B.MODULE_NAME, B.SEQUENCE FROM USER_ACCESS A JOIN MODULES B on A.MODULE_ID = B.MODULE_ID JOIN COURSES C on B.COURSE_ID = C.COURSE_ID WHERE A.USER_ID= @USER_ID AND A.EXPIRATION_DATE > GetDate() ORDER BY B.SEQUENCE The repeaters look like this of course:<asp:Repeater runat="server" ID="rptCourses" EnableViewState="false"> <ItemTemplate> <div> &l

Linq to SQL Web Service cannot be serialized problem

Hello All, Ok so I'm playing around with Web Services using Linq to SQl. I apparently have  a lot of learning to do. What I'm trying to do below is pull data from the Northwind db Employee Table. I don't need to see the whole table, I'm just trying to select individual(s) but I keep getting the following error  "System.Data.Linq.Binary cannot be serialized because it does not have a parameterless constructor" Code Below: Thanks in advance for any advice <WebMethod()> _ Public Function EmployeeInfo() As List(Of Employee) Dim db As New NorthwindDataContext() Dim output = From cust In db.Employees _ Select cust.EmployeeID, cust.FirstName, cust.LastName Return output End Function  

WCF function call in page load not working asynchronously

Hi all, I am trying to implement the WCF async function call in my page load event but, it not working asynchronously. Which means page content is displayed only after the asynchronous event is completed. This is my code         protected void Page_Load(object sender, EventArgs e)         {             if (!IsPostBack)             {                 ServiceReference1.Service1Client srv = new WebApplication1.ServiceReference1.Service1Client();                 srv.GetListCompleted += new EventHandler<WebApplication1.ServiceReference1.GetListCompletedEventArgs>(srv_GetListCompleted);                 srv.GetListAsync();             }         }           void srv_GetListCompleted(object sender, WebApplication1.ServiceReference1.GetListCompletedEventArgs e)         {         

Calling a Web Service Method Asynchronously does not work in Console Application

I have a web service that has a CreateReport method that generates a report based on the specified criteria. When I call this method Synchronously using a Windows Application or Console Application, the call works fine and the report is created. When I call this method ASynchronously (CreateReportASync) using Windows Application the report is created. When I call this method ASynchronously (CreateReportASync) using Console Application the web service does not even get the call.  I am using VS2005 and .Net Framework 2.0.  So the proxy is automatically created with the Async methods.  I am not really interested the result of the method call, so I do not add a Callback Delegate.  

Question on WCF service with Linq to SQL on 64-bit system

I'm trying this question one more time since I realized the work in in a 64-bit environment. I have a WCF service which runs in production in a 32-bit environment using VS2008 and .NET 2.0. We made a big change to our environment (lots at the same time) and I moved the services to VS2010, .NET 4.0, and 64-bit processes.  I wrote a new service and deployed it under IIS.  If I browse to the service I get the example screen and clicking on the link gives me the metadata.  So all of that is working. In my services I create a Linq to SQL context, perform a query, then return the result set as an Array.  I wrapped the context creation with a using.  My tests returned an exception "Attempt to access an object that has already been disposed".  I traced it down and found that the code executes, forces the query, returns the results, exits the using statement (disposing the context properly) then exits the method.  The next thing I get is the exception, inside framework code, and it is linq code attempting to fulfill the query once again. I have searched until I'm blue in the face trying to find prior incidents and fixes but all I found was one post, two years ago, same problem with less debugging, and no answer to the problem other than 'don't use the using statement' which is a bad suggestion.  So for a work around I wrote a Co

Join linq queries with same field name

Hi everyone-I'm trying to join three Linq queries together.  One of the fields (rating) is the same name for each so when I add b.rating as you'll see below, I get a squiggly that says "Anonymous type member or property 'rating' is alread declared.   Dim customerCategoryA= (From a In dc.CategoryARatings _                                  Where a.userID = userID _                                  Select New With {a.productID, a.rating, a.ratingComment}) Dim customerCategoryB = (From b In dc.CategoryBRatings _                                 Where b.userID = userID _                                 Select New With {b.productID, b.rating}) Dim DataForGridview = From p In Products _   

Load balancing using web service

Hi Friends                 Presently we are developing a windows product using dot net, combined with sas (another language). If sas not get installed in local machines then we are in need of using server machine which has sas with it, we are using socket programming to communicate with server machine, Problem is when more number of requests comes to the server for processing sas it is becoming slow, so we need  Load balancing If we go with web service which is having same domain name but different ip address mapped using Domain Name System (DNS) We will get work done faster     What i want is will this work fine, what else i have to done for achieving this, how can i test itWaitingBalaji Manoharan  

WCF Router service - How to implement Load Balance



Do you know if is possible to implement a Load Balance using this WCF Router Service ?

I know that WCF Router Service has routing and backuplist feature. 

By the way, how does WCF Routr Service deal with services that have Callback Contract ?


Luis Filipe (from Brazil: Sorry about the English!)

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend