Databinding ASP.NET gridview using multithreading
-
Hi, I have four gridview in my asp.net page. I want to call databind method asynchronouly. I don't want to call it sequentially as it consumes lot of time. What is the best way to do this? What are the potential issues of trying to do databaind operation in differnt thread for the same browser. Thanks in advance. Afsal
-
Hi, I have four gridview in my asp.net page. I want to call databind method asynchronouly. I don't want to call it sequentially as it consumes lot of time. What is the best way to do this? What are the potential issues of trying to do databaind operation in differnt thread for the same browser. Thanks in advance. Afsal
It will consume more time to populate if you do it asynchronously. The best way I have found to present the user with a loaded page and then load data after the page is rendered is with AJAX calls. The other method is to use an aysnc page but that is no fun.
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost
-
It will consume more time to populate if you do it asynchronously. The best way I have found to present the user with a loaded page and then load data after the page is rendered is with AJAX calls. The other method is to use an aysnc page but that is no fun.
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost
Thanks for the reply. Well, I need to resolve this somehow. The issue I am facing now is four database calls altogether takes around 1 minute to retrieve the data. So I thought of making it into four different threads and binding it seperately. Are you sure it will not give me advantage? If I am loading everything at one shot, i am getting a "script taking longer time. Are you want to abort" like java script error message. Also, can you please explain your solution in a bit detail? May be by giving some links!
-
Thanks for the reply. Well, I need to resolve this somehow. The issue I am facing now is four database calls altogether takes around 1 minute to retrieve the data. So I thought of making it into four different threads and binding it seperately. Are you sure it will not give me advantage? If I am loading everything at one shot, i am getting a "script taking longer time. Are you want to abort" like java script error message. Also, can you please explain your solution in a bit detail? May be by giving some links!
Multithreading may not be a solution here. The queries you are running dont seem very efficient. If these queries are taking one minute to run, than you might have to rethink what you are attempting. Here are a few suggestions: 1) Make sure your tables/views are indexed. If they are make sure your indexes are not fragmented. That will cause your queries to take longer than they should. 2) If you are using SELECT * and dont need all those columns, updatethe query to selec the columns you actually need. 3) Use stored procedures instead of inline queries. Stored procedures have an advantage because their statistics/execution plans are stored for future executions. This may increase the time it takes to run your query. 4) Make sure you dont have crazy joins. These are usually a major problem with complex, slow running queries. 5) If you are returing many many many rows, you may want to consider server side paging. Hope this helps.