473,508 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asynchronous WebService Callback to Force Postback

Hello,

I have an ASP.Net webform that shows numerous attributes of parts we sell.
There is one portion of the form that I have the user click a button to get
the information for. I did this for two reasons: 1) not everyone wants to
see it every time. 2) Depending on the complexity of the part, it can take a
while.

Everything works great. However, on complex parts (say that return 10,000 +
lines) the browser says it is "Not Responding" but I know I just have to
wait. I then did some research and it sounds as if I make an Asynchronous
call to the WebService method, I would not get the Not Responding issue.

So here is my code when they click the button to get the information...

private void Button1_Click(object sender, System.EventArgs e) {
dgrdBOM.Visible = true;
AsyncCallback cb = new AsyncCallback(this.QueryCallback);
IAsyncResult ar = oWS.BeginGetItemBOM(iUniqueID, iOrganizationID, 1,
cb, oWS);
lablTest.Text = "Kevin";
}

I threw the lablTest in there to make sure it at least gets that far and it
does. Here is the callback function.

public void QueryCallback(IAsyncResult ar) {
PartExplorerWS.PartInfo oWS2 = (PartExplorerWS.PartInfo) ar.AsyncState;
DataSet dsResults;

lablTest.Text = "Here";
dsResults = oWS2.EndGetItemBOM(ar);
dgrdBOM.DataSource = dsResults;
dgrdBOM.DataBind();
dgrdBOM.Visible = true;
}

I never get the lablTest to update to "Here" The specific query I am
running should only take about 1-2 seconds in this test case. Am I missing
something?

TIA,
Grigs
Nov 19 '05 #1
3 2190
your approach will not work. here is your flow

browser ->> requests page

webform
onload page
starts asyn webcall
<<--- returns page response
browser renders page

<<-- async call finshes
update form data in server memory.
unless the asyn call finishes before the page response is sent to the
browser, the browser never sees the results. you need to wait on the async
call in the prerender event, but this may defeat the purpose of the async
call.

you should start a background thread to do the query, then have the page
poll for the result.

-- bruce (sqlwork.com)
"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
| Hello,
|
| I have an ASP.Net webform that shows numerous attributes of parts we sell.
| There is one portion of the form that I have the user click a button to
get
| the information for. I did this for two reasons: 1) not everyone wants
to
| see it every time. 2) Depending on the complexity of the part, it can
take a
| while.
|
| Everything works great. However, on complex parts (say that return 10,000
+
| lines) the browser says it is "Not Responding" but I know I just have to
| wait. I then did some research and it sounds as if I make an Asynchronous
| call to the WebService method, I would not get the Not Responding issue.
|
| So here is my code when they click the button to get the information...
|
| private void Button1_Click(object sender, System.EventArgs e) {
| dgrdBOM.Visible = true;
| AsyncCallback cb = new AsyncCallback(this.QueryCallback);
| IAsyncResult ar = oWS.BeginGetItemBOM(iUniqueID, iOrganizationID, 1,
| cb, oWS);
| lablTest.Text = "Kevin";
| }
|
| I threw the lablTest in there to make sure it at least gets that far and
it
| does. Here is the callback function.
|
| public void QueryCallback(IAsyncResult ar) {
| PartExplorerWS.PartInfo oWS2 = (PartExplorerWS.PartInfo)
ar.AsyncState;
| DataSet dsResults;
|
| lablTest.Text = "Here";
| dsResults = oWS2.EndGetItemBOM(ar);
| dgrdBOM.DataSource = dsResults;
| dgrdBOM.DataBind();
| dgrdBOM.Visible = true;
| }
|
| I never get the lablTest to update to "Here" The specific query I am
| running should only take about 1-2 seconds in this test case. Am I
missing
| something?
|
| TIA,
| Grigs
Nov 19 '05 #2
That makes sense. Thank you.

So, do you have an example of your thread suggestion?

Grigs

"bruce barker" wrote:
your approach will not work. here is your flow

browser ->> requests page

webform
onload page
starts asyn webcall
<<--- returns page response
browser renders page

<<-- async call finshes
update form data in server memory.
unless the asyn call finishes before the page response is sent to the
browser, the browser never sees the results. you need to wait on the async
call in the prerender event, but this may defeat the purpose of the async
call.

you should start a background thread to do the query, then have the page
poll for the result.

-- bruce (sqlwork.com)
"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
| Hello,
|
| I have an ASP.Net webform that shows numerous attributes of parts we sell.
| There is one portion of the form that I have the user click a button to
get
| the information for. I did this for two reasons: 1) not everyone wants
to
| see it every time. 2) Depending on the complexity of the part, it can
take a
| while.
|
| Everything works great. However, on complex parts (say that return 10,000
+
| lines) the browser says it is "Not Responding" but I know I just have to
| wait. I then did some research and it sounds as if I make an Asynchronous
| call to the WebService method, I would not get the Not Responding issue.
|
| So here is my code when they click the button to get the information...
|
| private void Button1_Click(object sender, System.EventArgs e) {
| dgrdBOM.Visible = true;
| AsyncCallback cb = new AsyncCallback(this.QueryCallback);
| IAsyncResult ar = oWS.BeginGetItemBOM(iUniqueID, iOrganizationID, 1,
| cb, oWS);
| lablTest.Text = "Kevin";
| }
|
| I threw the lablTest in there to make sure it at least gets that far and
it
| does. Here is the callback function.
|
| public void QueryCallback(IAsyncResult ar) {
| PartExplorerWS.PartInfo oWS2 = (PartExplorerWS.PartInfo)
ar.AsyncState;
| DataSet dsResults;
|
| lablTest.Text = "Here";
| dsResults = oWS2.EndGetItemBOM(ar);
| dgrdBOM.DataSource = dsResults;
| dgrdBOM.DataBind();
| dgrdBOM.Visible = true;
| }
|
| I never get the lablTest to update to "Here" The specific query I am
| running should only take about 1-2 seconds in this test case. Am I
missing
| something?
|
| TIA,
| Grigs

Nov 19 '05 #3
google this newsgroup on progress bar - its the same problem.

-- bruce (sqlwork.com)

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
| That makes sense. Thank you.
|
| So, do you have an example of your thread suggestion?
|
| Grigs
|
| "bruce barker" wrote:
|
| > your approach will not work. here is your flow
| >
| > browser ->> requests page
| >
| > webform
| > onload page
| > starts asyn webcall
| > <<--- returns page response
| > browser renders page
| >
| > <<-- async call finshes
| > update form data in server memory.
| >
| >
| > unless the asyn call finishes before the page response is sent to the
| > browser, the browser never sees the results. you need to wait on the
async
| > call in the prerender event, but this may defeat the purpose of the
async
| > call.
| >
| > you should start a background thread to do the query, then have the page
| > poll for the result.
| >
| > -- bruce (sqlwork.com)
| >
| >
| > "Grigs" <Gr***@discussions.microsoft.com> wrote in message
| > news:CE**********************************@microsof t.com...
| > | Hello,
| > |
| > | I have an ASP.Net webform that shows numerous attributes of parts we
sell.
| > | There is one portion of the form that I have the user click a button
to
| > get
| > | the information for. I did this for two reasons: 1) not everyone
wants
| > to
| > | see it every time. 2) Depending on the complexity of the part, it can
| > take a
| > | while.
| > |
| > | Everything works great. However, on complex parts (say that return
10,000
| > +
| > | lines) the browser says it is "Not Responding" but I know I just have
to
| > | wait. I then did some research and it sounds as if I make an
Asynchronous
| > | call to the WebService method, I would not get the Not Responding
issue.
| > |
| > | So here is my code when they click the button to get the
information...
| > |
| > | private void Button1_Click(object sender, System.EventArgs e) {
| > | dgrdBOM.Visible = true;
| > | AsyncCallback cb = new AsyncCallback(this.QueryCallback);
| > | IAsyncResult ar = oWS.BeginGetItemBOM(iUniqueID,
iOrganizationID, 1,
| > | cb, oWS);
| > | lablTest.Text = "Kevin";
| > | }
| > |
| > | I threw the lablTest in there to make sure it at least gets that far
and
| > it
| > | does. Here is the callback function.
| > |
| > | public void QueryCallback(IAsyncResult ar) {
| > | PartExplorerWS.PartInfo oWS2 = (PartExplorerWS.PartInfo)
| > ar.AsyncState;
| > | DataSet dsResults;
| > |
| > | lablTest.Text = "Here";
| > | dsResults = oWS2.EndGetItemBOM(ar);
| > | dgrdBOM.DataSource = dsResults;
| > | dgrdBOM.DataBind();
| > | dgrdBOM.Visible = true;
| > | }
| > |
| > | I never get the lablTest to update to "Here" The specific query I am
| > | running should only take about 1-2 seconds in this test case. Am I
| > missing
| > | something?
| > |
| > | TIA,
| > | Grigs
| >
| >
| >
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2829
by: Natalia DeBow | last post by:
Hi, I am working on a Windows-based client-server application. I am involved in the development of the remote client modules. I am using asynchronous delegates to obtain information from...
8
3005
by: TC | last post by:
Hello, I am making an asynchronous call to a webservice and trying to update the web page with the results. The page is not updating. Does anybody know why??? Below is my code:
4
3381
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void...
0
1719
by: Tim Mackey | last post by:
Hi, I have a windows forms app, and a web service that can take a long time to complete, so i use it asynchronously with the proxy generated Begin/End methods. However, i want the user to be...
4
2316
by: jim | last post by:
Hi All, I try to make an asynchronous call to a web service method as below under MS visual .NET studio 2003: WebService webSrv = new WebService(); AsyncCallback cb = new...
0
1618
by: Raymondr | last post by:
Hi, First a brief description of out application: We have a webapplication which calls a couple of webservices during one request (postback). These calls to the webservices are made concurrent...
1
1919
by: kkao77 | last post by:
Someone help me please. I've tried to write an asynchronous method, but it didn't call my web service, do I need to do something in my webservice project to make it work? or if there is...
10
2164
by: Susan | last post by:
I have a process that takes a while to run so I have it running asynchronously so that the user can continue working. My question is that I want to killl the process if the user changes the search...
2
1610
by: =?Utf-8?B?S2FseWFu?= | last post by:
Hi, I have to make multiple calls (about 400K) to a webservice which returns a string. And currently it takes about a week to make all the calls. Instead of waiting for the webservice result ...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.