PreRenderComplete event woe

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?
 
H

Han

OOOOPS

Dont' mind.

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

Thanks for this NG. Posting always makes me brighter.
 
B

bruce barker

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)
 
H

Han

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top