G
Guest
I have a multithreaded application is ASP.NET that checks the status of a
process every 2 seconds. After the thread has completed, the values of
dynamically added controls need to be changed depending on the return value
from the process just completed on the second thread. The problem I am having
is that while the code seems to work correctly (I am performing a
response.write and writting out the values as a HTML comment), the final
display to the end user shows the initial value set to the dynamic control.
Any idea why this is happening? Any help will be welcome.
Here is what I am doing:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim oThread AS CustomThreadClass
Dim oControl AS DropDownList
'build all the dynamic controls
BuildDynamicControls
'if this is a postback - check the status of the thread and change value
of dynamic control
If IsPostBack Then
oThread = Session("Threading")
If Not oThread Is Nothing Then
If oThread.Status = oThread.StatusEnum.Completed Then
'find the dynamic control by using a custom method that recursively
searches for the dynamic control
oControl = FindControlByName("lstStatus")
oControl.SelectedItem = 2
Response.Write ("<!-- Value: " & oControl.Text & " -->")
End If
End If
End If
'code to sleep for 2 seconds and refresh page goes here - will not
replicate this
End Sub
process every 2 seconds. After the thread has completed, the values of
dynamically added controls need to be changed depending on the return value
from the process just completed on the second thread. The problem I am having
is that while the code seems to work correctly (I am performing a
response.write and writting out the values as a HTML comment), the final
display to the end user shows the initial value set to the dynamic control.
Any idea why this is happening? Any help will be welcome.
Here is what I am doing:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim oThread AS CustomThreadClass
Dim oControl AS DropDownList
'build all the dynamic controls
BuildDynamicControls
'if this is a postback - check the status of the thread and change value
of dynamic control
If IsPostBack Then
oThread = Session("Threading")
If Not oThread Is Nothing Then
If oThread.Status = oThread.StatusEnum.Completed Then
'find the dynamic control by using a custom method that recursively
searches for the dynamic control
oControl = FindControlByName("lstStatus")
oControl.SelectedItem = 2
Response.Write ("<!-- Value: " & oControl.Text & " -->")
End If
End If
End If
'code to sleep for 2 seconds and refresh page goes here - will not
replicate this
End Sub