PreRenderComplete event woe

  • Thread starter Thread starter Han
  • Start date Start date
H

Han

Hello

I am experiencing duplicate Page_PreRenderComplete events. I am using
webservice in async mode.

Skeleton is,

class class1: System.Web.UI.Page
{

private int test=0;

protected void Page_PreRenderComplete(Object sender, EventArgs e)
{
test++;
div1.InnerHtml += test.ToString() + "<br/>";
}

protected void Page_Load(object sender, EventArgs e)
{
this.PreRenderComplete += new EventHandler(Page_PreRenderComplete);

proxy1.webmethodCompleted +=
new webmethodCompletedEventHandler(transactionCompleted);
proxy1.webmethodAsync();
}

}

Now the result is always,

1
2

....


Currently I only use the async-method's event, transactionCompleted, as
workaround. But what if I use multiple asynchronous web-methods?
begin-end-transactions set may work, but I just want PreRenderComplete as a
neat solution.

Do you have any idea?
 
OOOOPS

Dont' mind.

page_prerenderComplete is a reserved event name. I just added redundant one;

Thanks for this NG. Posting always makes me brighter.
 
prerender complete is called twice, once by page processing and once by
your webservice callback. also you need to add a wait for the webserive
to complete. in production, you will find the callback often happens
after the page is rendered, so will have no effect on the produced html.

-- bruce (sqlwork.com)
 
Hi bruce

bruce barker said:
prerender complete is called twice, once by page processing and once by
your webservice callback.

Did you see my own reply before your post? Prerender-complete event is
called once. The redundant call is raised by my wrong assignment.
Additionally, why do you think the event is called by webservice? I can't
find any comment on that on my MSDN.

---
The PreRenderComplete event is raised when the pre-render stage of the page
life cycle is complete. At this stage of the page life cycle, all controls
are created, any pagination required is completed, and the page is ready to
render to the output.
---

If your statement is correct, part of Microsoft technology should be just
big mess. Can you provide us some repro or some more stuff for your
statement?

also you need to add a wait for the webserive
 
Back
Top