an asp.net page just builds html and sends it to the browser, its not
connected the simple cycle is
1) start request
2) create page class instance
3) call page events
4) return html
5) end request
you are updating the server control after the web request is completed.
the fix is in formload or prerender add a wait until the async call
completes, then continue the page processing.
-- bruce (sqlwork.com)
sandrofurlan wrote:
> Hi all,
> I'm a newbie about asp.net.
>
> I've a web client that call in async mode one webservice method
> The problem is that I don't know how to refresh control text property.
>
> Some code:
>
> Protected Sub ServiceCallback(ByVal ar As IAsyncResult)
> Dim client As ServiceClient = ar.AsyncState
> Dim e As ServiceEventArgs = client.EndWaitEvent(ar)
> If e.Status = 4 Then
> Label1.text = "result OK" <----
> Else
> Label1.text = "result False" <----
> End If
> ' reload callback handler
> Dim callBack As New AsyncCallback(AddressOf ServiceCallback)
> client.BeginWaitEvent(callBack, client)
> End Sub
>
> Protected Sub form1_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles form1.Load
> Dim client As New ServiceClient
> Label1.Text = "Open" & client.StartService()
> Dim callBack As New AsyncCallback(AddressOf ServiceCallback)
> Dim Iar As IAsyncResult = client.BeginWaitEvent(callBack,
> client)
> End Sub
>
> The problem is that label1.text could not change.
>
> Some idea?
> Thanks,
>
> Sandro Furlan
>
|