ASyncronous Web Pages




This the scenario: in a web page I want to fill data into a datagrid with a
process that take
long time.
Here is the codebehind page:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
GRID1.Visible = False
End Sub

Protected Sub Btn_Calc_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Btn_Calc.Click
StartCalc = New System.Web.BeginEventHandler(AddressOf Me.LoadGrid)
EndCalc = New System.Web.EndEventHandler(AddressOf Me.ShowGrid)
Me.AddOnPreRenderCompleteAsync(StartCalc, EndCalc)
End Sub

Function LoadGrid(ByVal sender As Object, ByVal e As System.EventArgs, ByVal
cb As System.AsyncCallback, ByVal extradata As Object) As System.IAsyncResult
<some code to fill data into a GridView (GRID1)
from sql server>
End Function

Private Sub ShowGrid(ByVal ar As System.IAsyncResult)
GRID1.Visible = True
End Sub

It gaves me the error: "IAsyncResult returned from Begin method is null".

I don't know what kind of return value I need.

Any help ?

Thaks in advance.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question