473,804 Members | 2,147 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(o bject sender, System.EventArg s e) {
dgrdBOM.Visible = true;
AsyncCallback cb = new AsyncCallback(t his.QueryCallba ck);
IAsyncResult ar = oWS.BeginGetIte mBOM(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(I AsyncResult ar) {
PartExplorerWS. PartInfo oWS2 = (PartExplorerWS .PartInfo) ar.AsyncState;
DataSet dsResults;

lablTest.Text = "Here";
dsResults = oWS2.EndGetItem BOM(ar);
dgrdBOM.DataSou rce = dsResults;
dgrdBOM.DataBin d();
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 2205
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***@discussi ons.microsoft.c om> wrote in message
news:CE******** *************** ***********@mic rosoft.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(o bject sender, System.EventArg s e) {
| dgrdBOM.Visible = true;
| AsyncCallback cb = new AsyncCallback(t his.QueryCallba ck);
| IAsyncResult ar = oWS.BeginGetIte mBOM(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(I AsyncResult ar) {
| PartExplorerWS. PartInfo oWS2 = (PartExplorerWS .PartInfo)
ar.AsyncState;
| DataSet dsResults;
|
| lablTest.Text = "Here";
| dsResults = oWS2.EndGetItem BOM(ar);
| dgrdBOM.DataSou rce = dsResults;
| dgrdBOM.DataBin d();
| 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***@discussi ons.microsoft.c om> wrote in message
news:CE******** *************** ***********@mic rosoft.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(o bject sender, System.EventArg s e) {
| dgrdBOM.Visible = true;
| AsyncCallback cb = new AsyncCallback(t his.QueryCallba ck);
| IAsyncResult ar = oWS.BeginGetIte mBOM(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(I AsyncResult ar) {
| PartExplorerWS. PartInfo oWS2 = (PartExplorerWS .PartInfo)
ar.AsyncState;
| DataSet dsResults;
|
| lablTest.Text = "Here";
| dsResults = oWS2.EndGetItem BOM(ar);
| dgrdBOM.DataSou rce = dsResults;
| dgrdBOM.DataBin d();
| 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***@discussi ons.microsoft.c om> wrote in message
news:D2******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
| > news:CE******** *************** ***********@mic rosoft.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(o bject sender, System.EventArg s e) {
| > | dgrdBOM.Visible = true;
| > | AsyncCallback cb = new AsyncCallback(t his.QueryCallba ck);
| > | IAsyncResult ar = oWS.BeginGetIte mBOM(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(I AsyncResult ar) {
| > | PartExplorerWS. PartInfo oWS2 = (PartExplorerWS .PartInfo)
| > ar.AsyncState;
| > | DataSet dsResults;
| > |
| > | lablTest.Text = "Here";
| > | dsResults = oWS2.EndGetItem BOM(ar);
| > | dgrdBOM.DataSou rce = dsResults;
| > | dgrdBOM.DataBin d();
| > | 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
2843
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 remote server and display this info on the UI. From doing some research, I know that the way my implementation works today is not thread-safe, because essentially my worker thread updates the UI, which is BAD. So, here I am trying to figure out how...
8
3020
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
3427
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 RaiseCallbackEvent(string eventArgs) { // update the data object with the values currently on screen FormView1.UpdateItem(true); }
0
1728
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 able to cancel the operation. i understand that the request has already been sent off, and the next thing we'll hear back is when the result is received, so an actualy cancel will be difficult to achieve. I have tried calling webService.Abort() but...
4
2332
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 AsyncCallback(TrsWebSvsCallback); IAsyncResult ar = webSrv.BeginProcessCall( 1, cb, transWeb40); while (ar.IsCompleted == false)
0
1626
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 using asynchronous webservices calls. The number of webservices called concurrent is between 1 and 18. The webservice calls are made using SSL with a X509 clientcertificate. The application is underhigh load
1
1930
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 something wrong with the code that I have below. Thanks.. The following are my two methods where one is calling web service and
10
2189
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 parameters before the callback method is called. Any ideas of how to do this or if it even matters? I did not know if calling the asynch process a new time kills the previous one or not. Thank you for your help. Susan
2
1623
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 before i make the next call, I rather want to make the calls and let the results comeback at its own pace. I used Asynchronous calling and callback method, but it does not seems to work. I am sure, asynchronous way will improve my program execution...
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7633
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4306
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 we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.