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:
public class ASPNetSuperhero : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList drplstFilePaths;
protected System.Web.UI.WebControls.TextBox txtMessage;
protected System.Web.UI.WebControls.Button btnStartFileSearch;
private localhost.ASPNetSuperheroService GetWordCount;
protected System.Web.UI.WebControls.Label lblWordCount;
private AsyncCallback MyWordCountCallback;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnStartFileSearch.Click += new
System.EventHandler(this.btnStartFileSearch_Click) ;
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnStartFileSearch_Click(object sender, System.EventArgs e)
{
MyWordCountCallback = new AsyncCallback(WordCountCallback);
/* Create new instance of the webservice that provides
the required functionality*/
GetWordCount=new localhost.ASPNetSuperheroService();
GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount);
}
private void WordCountCallback(IAsyncResult Result)
{
// Call the webservice method in order to get current word count
this.txtMessage.Text=GetWordCount.EndWordCount(Res ult);
}
}
Regards,
TC 8 2969
if you are calling web service from an ASP.Net page on the server side, you
need wait till the call completes. use IAsynchResult.WaitHandle.WaitOne()
check this if you need more info.. http://msdn.microsoft.com/library/de...ce09032002.asp
Av. http://www.avnrao.blogspot.com
"TC" <ge**********@yahoo.com> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl... 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:
public class ASPNetSuperhero : System.Web.UI.Page { protected System.Web.UI.WebControls.DropDownList drplstFilePaths; protected System.Web.UI.WebControls.TextBox txtMessage; protected System.Web.UI.WebControls.Button btnStartFileSearch;
private localhost.ASPNetSuperheroService GetWordCount; protected System.Web.UI.WebControls.Label lblWordCount; private AsyncCallback MyWordCountCallback;
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnStartFileSearch.Click += new System.EventHandler(this.btnStartFileSearch_Click) ; this.Load += new System.EventHandler(this.Page_Load);
} #endregion
private void btnStartFileSearch_Click(object sender, System.EventArgs e) { MyWordCountCallback = new AsyncCallback(WordCountCallback); /* Create new instance of the webservice that provides the required functionality*/ GetWordCount=new localhost.ASPNetSuperheroService(); GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount); }
private void WordCountCallback(IAsyncResult Result) { // Call the webservice method in order to get current word count this.txtMessage.Text=GetWordCount.EndWordCount(Res ult); } }
Regards,
TC
Hey folks,
I need C# assistance for non-blocking, asynch callback from the web page.
I am currently receiving the appropriate values back but the page does not
update.
Does anyone know why?
Regards,
TC
"avnrao" <av*@newsgroups.com> wrote in message
news:O$**************@TK2MSFTNGP09.phx.gbl... if you are calling web service from an ASP.Net page on the server side,
you need wait till the call completes. use IAsynchResult.WaitHandle.WaitOne() check this if you need more info.. http://msdn.microsoft.com/library/de...ce09032002.asp Av. http://www.avnrao.blogspot.com
"TC" <ge**********@yahoo.com> wrote in message news:uN**************@TK2MSFTNGP10.phx.gbl... 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:
public class ASPNetSuperhero : System.Web.UI.Page { protected System.Web.UI.WebControls.DropDownList drplstFilePaths; protected System.Web.UI.WebControls.TextBox txtMessage; protected System.Web.UI.WebControls.Button btnStartFileSearch;
private localhost.ASPNetSuperheroService GetWordCount; protected System.Web.UI.WebControls.Label lblWordCount; private AsyncCallback MyWordCountCallback;
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnStartFileSearch.Click += new System.EventHandler(this.btnStartFileSearch_Click) ; this.Load += new System.EventHandler(this.Page_Load);
} #endregion
private void btnStartFileSearch_Click(object sender, System.EventArgs
e) { MyWordCountCallback = new AsyncCallback(WordCountCallback); /* Create new instance of the webservice that provides the required functionality*/ GetWordCount=new localhost.ASPNetSuperheroService(); GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount); }
private void WordCountCallback(IAsyncResult Result) { // Call the webservice method in order to get current word count this.txtMessage.Text=GetWordCount.EndWordCount(Res ult); } }
Regards,
TC
Hello,
ASP.NET application uses request/response architecture, and it may not be
suitable for asynchronous call to a web service. Regarding your code:
private void btnStartFileSearch_Click(object sender, System.EventArgs e)
{
MyWordCountCallback = new AsyncCallback(WordCountCallback);
/* Create new instance of the webservice that provides
the required functionality*/
GetWordCount=new localhost.ASPNetSuperheroService();
GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount);
}
After BeginWordCount, the response will be write back to client, won't wait
here. You have to use synchronous call here.
Luke
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
You initiate the call but don't wait for the result. The goal of an
asynchornous call is for example :
- make the call to a web service
- do some work
- get the result (will still wait if not already available)
That way you can do some work in parallel.
If you need the result from the webservice and you have nothing to do in
between making an asynchronous call is useless.
Patrice
"TC" <ge**********@yahoo.com> a écrit dans le message de
news:uN**************@TK2MSFTNGP10.phx.gbl... 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:
public class ASPNetSuperhero : System.Web.UI.Page { protected System.Web.UI.WebControls.DropDownList drplstFilePaths; protected System.Web.UI.WebControls.TextBox txtMessage; protected System.Web.UI.WebControls.Button btnStartFileSearch;
private localhost.ASPNetSuperheroService GetWordCount; protected System.Web.UI.WebControls.Label lblWordCount; private AsyncCallback MyWordCountCallback;
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnStartFileSearch.Click += new System.EventHandler(this.btnStartFileSearch_Click) ; this.Load += new System.EventHandler(this.Page_Load);
} #endregion
private void btnStartFileSearch_Click(object sender, System.EventArgs e) { MyWordCountCallback = new AsyncCallback(WordCountCallback); /* Create new instance of the webservice that provides the required functionality*/ GetWordCount=new localhost.ASPNetSuperheroService(); GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount); }
private void WordCountCallback(IAsyncResult Result) { // Call the webservice method in order to get current word count this.txtMessage.Text=GetWordCount.EndWordCount(Res ult); } }
Regards,
TC
Actually, the idea would be to free up the GUI so that a user isn't stuck.
That makes an asynch call very useful. Then the user can do whatever work
they wish to and when the webservice returns the appropriate information,
the application can finish the work behind the scenes.
At least this is what I am trying to do.
Todd
"Patrice" <no****@nowhere.com> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl... You initiate the call but don't wait for the result. The goal of an asynchornous call is for example : - make the call to a web service - do some work - get the result (will still wait if not already available)
That way you can do some work in parallel.
If you need the result from the webservice and you have nothing to do in between making an asynchronous call is useless.
Patrice
"TC" <ge**********@yahoo.com> a écrit dans le message de news:uN**************@TK2MSFTNGP10.phx.gbl... 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:
public class ASPNetSuperhero : System.Web.UI.Page { protected System.Web.UI.WebControls.DropDownList drplstFilePaths; protected System.Web.UI.WebControls.TextBox txtMessage; protected System.Web.UI.WebControls.Button btnStartFileSearch;
private localhost.ASPNetSuperheroService GetWordCount; protected System.Web.UI.WebControls.Label lblWordCount; private AsyncCallback MyWordCountCallback;
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnStartFileSearch.Click += new System.EventHandler(this.btnStartFileSearch_Click) ; this.Load += new System.EventHandler(this.Page_Load);
} #endregion
private void btnStartFileSearch_Click(object sender, System.EventArgs
e) { MyWordCountCallback = new AsyncCallback(WordCountCallback); /* Create new instance of the webservice that provides the required functionality*/ GetWordCount=new localhost.ASPNetSuperheroService(); GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount); }
private void WordCountCallback(IAsyncResult Result) { // Call the webservice method in order to get current word count this.txtMessage.Text=GetWordCount.EndWordCount(Res ult); } }
Regards,
TC
"TC" <ge**********@yahoo.com> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl... 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???
Yes. Your page does not exist when your callback is called.
private void WordCountCallback(IAsyncResult Result) { // Call the webservice method in order to get current word count this.txtMessage.Text=GetWordCount.EndWordCount(Res ult); } }
When this method is called back, the request has already completed, the
response has already been sent to the client, and you are out of luck.
I recommend that you find some sample code which does this and follow that
example. I can recommend it because you're not going to find any such sample
code - the entire idea is contrary to the way that ASP.NET works.
See http://msdn.microsoft.com/library/de...singstages.asp.
--
John Saunders
John.Saunders at SurfControl.com
Humm. Sorry if I restate something ovbious...
The page the user sees is just some HTML that is rendered by the server side
APSX page. Once the ASPX page is finished the user see client side HTML code
and the page doesn't exist any more server side. You nedd then another HTTP
request to be in touch again with server side code.
I see basically two options :
- you need the webservice call to be completed to have a meaningfull page :
- out of luck, needs to wait the result from the webservice to construct
the final HTML page
- use an IFRAME that calls an ASPX page that calls this webservice. The
user can see a part of the final UI (done by the main ASPX page) but will
have still to wait a bit to see the inner frame content(done be the ASPX
page referenced by the IFRAME). Of course, if the webservice is quite
qucik,, the first optino is probably still the simpler.
- you don't need the webservice call to be completed (will be used sometimes
later)
- you could queue these calls to have them done seperately from the user
page (AFAIK .NET proivides something along these lines was called MSMQ
previously)
Do you recognize a case in which you are ?
Patrice
"TC" <ge**********@yahoo.com> a écrit dans le message de
news:es**************@TK2MSFTNGP11.phx.gbl... Actually, the idea would be to free up the GUI so that a user isn't stuck. That makes an asynch call very useful. Then the user can do whatever work they wish to and when the webservice returns the appropriate information, the application can finish the work behind the scenes.
At least this is what I am trying to do.
Todd
"Patrice" <no****@nowhere.com> wrote in message news:uF**************@TK2MSFTNGP09.phx.gbl... You initiate the call but don't wait for the result. The goal of an asynchornous call is for example : - make the call to a web service - do some work - get the result (will still wait if not already available)
That way you can do some work in parallel.
If you need the result from the webservice and you have nothing to do in between making an asynchronous call is useless.
Patrice
"TC" <ge**********@yahoo.com> a écrit dans le message de news:uN**************@TK2MSFTNGP10.phx.gbl... 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:
public class ASPNetSuperhero : System.Web.UI.Page { protected System.Web.UI.WebControls.DropDownList drplstFilePaths; protected System.Web.UI.WebControls.TextBox txtMessage; protected System.Web.UI.WebControls.Button btnStartFileSearch;
private localhost.ASPNetSuperheroService GetWordCount; protected System.Web.UI.WebControls.Label lblWordCount; private AsyncCallback MyWordCountCallback;
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnStartFileSearch.Click += new System.EventHandler(this.btnStartFileSearch_Click) ; this.Load += new System.EventHandler(this.Page_Load);
} #endregion
private void btnStartFileSearch_Click(object sender,
System.EventArgs e) { MyWordCountCallback = new AsyncCallback(WordCountCallback); /* Create new instance of the webservice that provides the required functionality*/ GetWordCount=new localhost.ASPNetSuperheroService(); GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount); }
private void WordCountCallback(IAsyncResult Result) { // Call the webservice method in order to get current word count this.txtMessage.Text=GetWordCount.EndWordCount(Res ult); } }
Regards,
TC
Hey Folks,
Thanks for the help!
Basically, because what I wish to do is contrary to the way in which ASP
works, I'm just gonna wait for the response to return.
Thanks Again,
TC
"Patrice" <no****@nowhere.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl... Humm. Sorry if I restate something ovbious...
The page the user sees is just some HTML that is rendered by the server
side APSX page. Once the ASPX page is finished the user see client side HTML
code and the page doesn't exist any more server side. You nedd then another
HTTP request to be in touch again with server side code.
I see basically two options :
- you need the webservice call to be completed to have a meaningfull page
: - out of luck, needs to wait the result from the webservice to
construct the final HTML page - use an IFRAME that calls an ASPX page that calls this webservice.
The user can see a part of the final UI (done by the main ASPX page) but will have still to wait a bit to see the inner frame content(done be the ASPX page referenced by the IFRAME). Of course, if the webservice is quite qucik,, the first optino is probably still the simpler.
- you don't need the webservice call to be completed (will be used
sometimes later) - you could queue these calls to have them done seperately from the
user page (AFAIK .NET proivides something along these lines was called MSMQ previously)
Do you recognize a case in which you are ?
Patrice
"TC" <ge**********@yahoo.com> a écrit dans le message de news:es**************@TK2MSFTNGP11.phx.gbl... Actually, the idea would be to free up the GUI so that a user isn't
stuck. That makes an asynch call very useful. Then the user can do whatever
work they wish to and when the webservice returns the appropriate
information, the application can finish the work behind the scenes.
At least this is what I am trying to do.
Todd
"Patrice" <no****@nowhere.com> wrote in message news:uF**************@TK2MSFTNGP09.phx.gbl... You initiate the call but don't wait for the result. The goal of an asynchornous call is for example : - make the call to a web service - do some work - get the result (will still wait if not already available)
That way you can do some work in parallel.
If you need the result from the webservice and you have nothing to do
in between making an asynchronous call is useless.
Patrice
"TC" <ge**********@yahoo.com> a écrit dans le message de news:uN**************@TK2MSFTNGP10.phx.gbl... > 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: > > public class ASPNetSuperhero : System.Web.UI.Page > { > protected System.Web.UI.WebControls.DropDownList drplstFilePaths; > protected System.Web.UI.WebControls.TextBox txtMessage; > protected System.Web.UI.WebControls.Button btnStartFileSearch; > > private localhost.ASPNetSuperheroService GetWordCount; > protected System.Web.UI.WebControls.Label lblWordCount; > private AsyncCallback MyWordCountCallback; > > private void Page_Load(object sender, System.EventArgs e) > { > // Put user code to initialize the page here > } > > #region Web Form Designer generated code > override protected void OnInit(EventArgs e) > { > // > // CODEGEN: This call is required by the ASP.NET Web Form
Designer. > // > InitializeComponent(); > base.OnInit(e); > } > > /// <summary> > /// Required method for Designer support - do not modify > /// the contents of this method with the code editor. > /// </summary> > private void InitializeComponent() > { > this.btnStartFileSearch.Click += new > System.EventHandler(this.btnStartFileSearch_Click) ; > this.Load += new System.EventHandler(this.Page_Load); > > } > #endregion > > private void btnStartFileSearch_Click(object sender, System.EventArgs e) > { > MyWordCountCallback = new AsyncCallback(WordCountCallback); > /* Create new instance of the webservice that provides > the required functionality*/ > GetWordCount=new localhost.ASPNetSuperheroService(); > GetWordCount.BeginWordCount(MyWordCountCallback,Ge tWordCount); > } > > private void WordCountCallback(IAsyncResult Result) > { > // Call the webservice method in order to get current word count > this.txtMessage.Text=GetWordCount.EndWordCount(Res ult); > } > } > > > Regards, > > TC > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sai Kit Tong |
last post by:
I have to interface managed application with my legacy dll. I have employed
the wrapper approach but I have to deal with the asynchronous callback from
the legacy dll, which likely goes through a...
|
by: Chris |
last post by:
Hello,
With asynchronous programming :
Why does the callback-function (running in a worker thread) may not update
the state of a control on the main-form ?
The docs say that you must use a...
|
by: Ingo Schasiepen |
last post by:
Hi there,
i'm evaluating if c# is suited to replace a script language. Most of
the elements of this language can be replaced with a c#-library, but
it also has some realtime-like elements. E.g.,...
|
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...
|
by: strout |
last post by:
I am using ASP.net as web service client.
I call BeginInvoke in a proxy and use a callback function to process the
result.
However, the callback function is not the same thread of the web...
|
by: niphylosoft |
last post by:
I've throughly searched this group but I couldn't find the answer to
forcing a page refresh.
I'm using a my web service on a web page, but when my
private void GetResult(IAsyncResult result)
is...
|
by: Siv |
last post by:
Hi,
I have a stored procedure that I want to execute and then wait in a loop
showing a timer whilst it completes and then carry on once I get
notification that it has completed. The main reason...
|
by: archana |
last post by:
Hi all,
I am processing asynchronous web request with setting timeout using
RegisterWaitForSingleObject.
On beginwebrequest i am sending address of one callback which i want to
execute when...
|
by: Bishoy George |
last post by:
Hi,
I have a asp.net 2.0 web application.
I want to implement the asynchronous model through http handler in
web.config
...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |