By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,882 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,882 IT Pros & Developers. It's quick & easy.

multi threading and AJAX

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a

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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.