473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

multi threading and AJAX

Hi guys,

I have this page that needs to be populated with 2 diferent web services,
and each one takes more or less 10 seconds to finish populate his own part,
so I move on to the multi threading inside ASP.NET.

my questions is:

having a ASP.NET AJAX page and my gridView inside an atlas:UpdatePanel
control how can I update the panel so it shows the datagrid with the results
from the webservice?

Sub callDRService()
Dim dr As New drService
dr.getDRInfoFromWebService("John", "Hansen", "Nørregade 86", "5700",
False)
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
End Sub

the up control is a UpdatePanel, but at the end of the thread the panel
simple wont update :-(

any thoughts?
code for page_load and thread call
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
populateDRFromWService_Thread()
End Sub
Public Sub populateDRFromWService_Thread()
Dim NewThread As Thread = New Thread(AddressOf callDRService)
NewThread.Priority = ThreadPriority.Lowest
NewThread.Start()
End Sub
-------------------------
--

Bruno Alexandre
København, Danmark

"a portuguese in Denmark"


Oct 12 '06 #1
4 2304

Interesting. This is probably not related to AJAX though. It probably is
related to the timing of the thread and the update call. Wrap your bind code
in a null check to make sure data is back before you call the update. That
will eliminate or confirm the timing issue.

if(dr.warningTable IsNotNull And dr.warningTable[0].rows.count 0) then
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
end if

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Bruno Alexandre" <br*********@gmail.comwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
Hi guys,

I have this page that needs to be populated with 2 diferent web services,
and each one takes more or less 10 seconds to finish populate his own
part, so I move on to the multi threading inside ASP.NET.

my questions is:

having a ASP.NET AJAX page and my gridView inside an atlas:UpdatePanel
control how can I update the panel so it shows the datagrid with the
results from the webservice?

Sub callDRService()
Dim dr As New drService
dr.getDRInfoFromWebService("John", "Hansen", "Nørregade 86", "5700",
False)
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
End Sub

the up control is a UpdatePanel, but at the end of the thread the panel
simple wont update :-(

any thoughts?
code for page_load and thread call
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
populateDRFromWService_Thread()
End Sub
Public Sub populateDRFromWService_Thread()
Dim NewThread As Thread = New Thread(AddressOf callDRService)
NewThread.Priority = ThreadPriority.Lowest
NewThread.Start()
End Sub
-------------------------
--

Bruno Alexandre
København, Danmark

"a portuguese in Denmark"


Oct 14 '06 #2
the problem remains...
after the page is completed, I can't update anything on it. even an
UpdatePanel :-(

what I did was wait for the 2 threads to finish and then show the page.
with MultiThreading I get the page shows up in aprox 4sec instead of the
9/12 sec before

not what I was searching in the first place - I want to present the page and
a progress bar saying that the webservice call is still running and when it
finish populate the gridview with all the info. but, I coudn't do that
yet... :-(

--

Bruno Alexandre
København, Danmark

"a Portuguese in Denmark"

Blog. http://balexandre.blogspot.com/
Photos. http://www.flickr.com/photos/balexandre/
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:ed**************@TK2MSFTNGP03.phx.gbl...
>
Interesting. This is probably not related to AJAX though. It probably is
related to the timing of the thread and the update call. Wrap your bind
code in a null check to make sure data is back before you call the update.
That will eliminate or confirm the timing issue.

if(dr.warningTable IsNotNull And dr.warningTable[0].rows.count 0) then
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
end if

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Bruno Alexandre" <br*********@gmail.comwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl...
>Hi guys,

I have this page that needs to be populated with 2 diferent web services,
and each one takes more or less 10 seconds to finish populate his own
part, so I move on to the multi threading inside ASP.NET.

my questions is:

having a ASP.NET AJAX page and my gridView inside an atlas:UpdatePanel
control how can I update the panel so it shows the datagrid with the
results from the webservice?

Sub callDRService()
Dim dr As New drService
dr.getDRInfoFromWebService("John", "Hansen", "Nørregade 86", "5700",
False)
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
End Sub

the up control is a UpdatePanel, but at the end of the thread the panel
simple wont update :-(

any thoughts?
code for page_load and thread call
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
populateDRFromWService_Thread()
End Sub
Public Sub populateDRFromWService_Thread()
Dim NewThread As Thread = New Thread(AddressOf callDRService)
NewThread.Priority = ThreadPriority.Lowest
NewThread.Start()
End Sub
-------------------------
--

Bruno Alexandre
København, Danmark

"a portuguese in Denmark"



Oct 14 '06 #3
post a short but complete program that demonstrates the problem. Short but
complete programs are defined here:
http://www.yoda.arachsys.com/csharp/complete.html

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Bruno Alexandre" <br*********@gmail.comwrote in message
news:eB**************@TK2MSFTNGP02.phx.gbl...
the problem remains...
after the page is completed, I can't update anything on it. even an
UpdatePanel :-(

what I did was wait for the 2 threads to finish and then show the page.
with MultiThreading I get the page shows up in aprox 4sec instead of the
9/12 sec before

not what I was searching in the first place - I want to present the page
and a progress bar saying that the webservice call is still running and
when it finish populate the gridview with all the info. but, I coudn't do
that yet... :-(

--

Bruno Alexandre
København, Danmark

"a Portuguese in Denmark"

Blog. http://balexandre.blogspot.com/
Photos. http://www.flickr.com/photos/balexandre/
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:ed**************@TK2MSFTNGP03.phx.gbl...
>>
Interesting. This is probably not related to AJAX though. It probably is
related to the timing of the thread and the update call. Wrap your bind
code in a null check to make sure data is back before you call the
update. That will eliminate or confirm the timing issue.

if(dr.warningTable IsNotNull And dr.warningTable[0].rows.count 0) then
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
end if

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Bruno Alexandre" <br*********@gmail.comwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl. ..
>>Hi guys,

I have this page that needs to be populated with 2 diferent web
services, and each one takes more or less 10 seconds to finish populate
his own part, so I move on to the multi threading inside ASP.NET.

my questions is:

having a ASP.NET AJAX page and my gridView inside an atlas:UpdatePanel
control how can I update the panel so it shows the datagrid with the
results from the webservice?

Sub callDRService()
Dim dr As New drService
dr.getDRInfoFromWebService("John", "Hansen", "Nørregade 86", "5700",
False)
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
End Sub

the up control is a UpdatePanel, but at the end of the thread the panel
simple wont update :-(

any thoughts?
code for page_load and thread call
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
populateDRFromWService_Thread()
End Sub
Public Sub populateDRFromWService_Thread()
Dim NewThread As Thread = New Thread(AddressOf callDRService)
NewThread.Priority = ThreadPriority.Lowest
NewThread.Start()
End Sub
-------------------------
--

Bruno Alexandre
København, Danmark

"a portuguese in Denmark"




Oct 15 '06 #4
this can't be for me right?
I gave the code, you gave me a response, and then I told what exactly I did
to get arround my problem!

maybe you just miss it.

--

Bruno Alexandre
København, Danmark

"a Portuguese in Denmark"

Blog. http://balexandre.blogspot.com/
Photos. http://www.flickr.com/photos/balexandre/
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:%2*****************@TK2MSFTNGP05.phx.gbl...
post a short but complete program that demonstrates the problem. Short but
complete programs are defined here:
http://www.yoda.arachsys.com/csharp/complete.html

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Bruno Alexandre" <br*********@gmail.comwrote in message
news:eB**************@TK2MSFTNGP02.phx.gbl...
>the problem remains...
after the page is completed, I can't update anything on it. even an
UpdatePanel :-(

what I did was wait for the 2 threads to finish and then show the page.
with MultiThreading I get the page shows up in aprox 4sec instead of the
9/12 sec before

not what I was searching in the first place - I want to present the page
and a progress bar saying that the webservice call is still running and
when it finish populate the gridview with all the info. but, I coudn't do
that yet... :-(

--

Bruno Alexandre
København, Danmark

"a Portuguese in Denmark"

Blog. http://balexandre.blogspot.com/
Photos. http://www.flickr.com/photos/balexandre/
"Alvin Bruney [MVP]" <www.lulu.com/owcwrote in message
news:ed**************@TK2MSFTNGP03.phx.gbl...
>>>
Interesting. This is probably not related to AJAX though. It probably is
related to the timing of the thread and the update call. Wrap your bind
code in a null check to make sure data is back before you call the
update. That will eliminate or confirm the timing issue.

if(dr.warningTable IsNotNull And dr.warningTable[0].rows.count 0) then
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
end if

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Bruno Alexandre" <br*********@gmail.comwrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl.. .
Hi guys,

I have this page that needs to be populated with 2 diferent web
services, and each one takes more or less 10 seconds to finish populate
his own part, so I move on to the multi threading inside ASP.NET.

my questions is:

having a ASP.NET AJAX page and my gridView inside an atlas:UpdatePanel
control how can I update the panel so it shows the datagrid with the
results from the webservice?

Sub callDRService()
Dim dr As New drService
dr.getDRInfoFromWebService("John", "Hansen", "Nørregade 86", "5700",
False)
gvDRWarnings.DataSource = dr.warningTable
gvDRWarnings.DataBind()
up.Update()
End Sub

the up control is a UpdatePanel, but at the end of the thread the panel
simple wont update :-(

any thoughts?
code for page_load and thread call
-------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
populateDRFromWService_Thread()
End Sub
Public Sub populateDRFromWService_Thread()
Dim NewThread As Thread = New Thread(AddressOf callDRService)
NewThread.Priority = ThreadPriority.Lowest
NewThread.Start()
End Sub
-------------------------
--

Bruno Alexandre
København, Danmark

"a portuguese in Denmark"




Oct 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
13
by: notregister | last post by:
my program have as many as 8 threads running at a same time. can different threads open a same file at the same time? let say thread1 open a file abc.txt at the same time with thread 2, both doing...
2
by: NiponW | last post by:
Hi, I have SQL SERVER 2000 SP4 Enterprise , Windows 2003 Enterprise on Xeon 4 Processors (now with multi-threading CPU) and I have questions which seem weirds to me (used to have the same...
2
by: johkar | last post by:
I have several related multi-selects on a page (country, state/ province, city, address). There are 4 - 7 other unrelated fields on the page also. Even though this is an intranet app where a...
0
ammoos
by: ammoos | last post by:
hi friends pls help me.. i got an assignment which i feel very difficult to me.. i dont have more knowledge about multi-threading in .net... the assignment details is below.... pls help me... i...
0
by: bharathreddy | last post by:
Vs 2008 is the MS latest IDE for developing Windows, Web, Smart Device Applications. It comes along with .NET Framework 3.5, C# 3.0, LINQ, ASP.NET AJAX and VSTO . Now with the power of VS 2008 we can...
5
by: George Maicovschi | last post by:
As multi-threading is not built in PHP I've been using a hack letting the Apache server handle the multi-threading issues, but I'm really curious of other approaches to this issue. If anyone has...
1
by: =?Utf-8?B?QU1lcmNlcg==?= | last post by:
Sorry this is so long winded, but here goes. Following the model of http://msdn2.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcchannel.aspx I made a remote object using the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.