Page Methods and ASCX
-
Hi. I have a situation where I need to use Page Methods instead of posts backs on an ASCX control. But I cant find a way that doesnt involve putting code in the main aspx page(which I cannot do due to specifics of the project). I also cannot create a web service. Basically each ascx control needs to be self containing and not call anything else. P.S. Update panels work for what I need, but are SLOW SLOW SLOW. Thanks
Strive to be humble enough to take advice, and confident enough to do something about it.
-
Hi. I have a situation where I need to use Page Methods instead of posts backs on an ASCX control. But I cant find a way that doesnt involve putting code in the main aspx page(which I cannot do due to specifics of the project). I also cannot create a web service. Basically each ascx control needs to be self containing and not call anything else. P.S. Update panels work for what I need, but are SLOW SLOW SLOW. Thanks
Strive to be humble enough to take advice, and confident enough to do something about it.
roguemat wrote:
Hi. I have a situation where I need to use Page Methods instead of posts backs on an ASCX control
Hi, I'm gonna guess you are talking about asp.net ajax.
roguemat wrote:
But I cant find a way that doesnt involve putting code in the main aspx page(which I cannot do due to specifics of the project).
To do this you can use ScriptManager.GetCurrent(Page); if you have a ScriptManager on your page already.
roguemat wrote:
I also cannot create a web service. Basically each ascx control needs to be self containing and not call anything else.
Well yeah they need to make a web request I guess.
roguemat wrote:
P.S. Update panels work for what I need, but are SLOW SLOW SLOW.
Well update panels use what we call ajax so they are just as fast as any request made by browser. Did I guess any thing right ?
-
roguemat wrote:
Hi. I have a situation where I need to use Page Methods instead of posts backs on an ASCX control
Hi, I'm gonna guess you are talking about asp.net ajax.
roguemat wrote:
But I cant find a way that doesnt involve putting code in the main aspx page(which I cannot do due to specifics of the project).
To do this you can use ScriptManager.GetCurrent(Page); if you have a ScriptManager on your page already.
roguemat wrote:
I also cannot create a web service. Basically each ascx control needs to be self containing and not call anything else.
Well yeah they need to make a web request I guess.
roguemat wrote:
P.S. Update panels work for what I need, but are SLOW SLOW SLOW.
Well update panels use what we call ajax so they are just as fast as any request made by browser. Did I guess any thing right ?
daveyerwin wrote:
Did I guess any thing right ?
Only the first one.
daveyerwin wrote:
To do this you can use ScriptManager.GetCurrent(Page);
Has nothing to do with PageMethod
daveyerwin wrote:
Well yeah they need to make a web request I guess.
I'll give you this one also just for stating the blatantly obvious.
daveyerwin wrote:
update panels use what we call ajax so they are just as fast
An ASP.NET UpdatePanel still goes through the page life cycle so yes it can be slow. Making a direct out of band AJAX call is much faster
I know the language. I've read a book. - _Madmatt
-
Hi. I have a situation where I need to use Page Methods instead of posts backs on an ASCX control. But I cant find a way that doesnt involve putting code in the main aspx page(which I cannot do due to specifics of the project). I also cannot create a web service. Basically each ascx control needs to be self containing and not call anything else. P.S. Update panels work for what I need, but are SLOW SLOW SLOW. Thanks
Strive to be humble enough to take advice, and confident enough to do something about it.
Try having a look here, http://www.chadscharf.com/index.php/2009/11/creating-a-page-method-scriptmethod-within-an-ascx-user-control-using-ajax-json-base-classes-and-reflection/[^] However, I would say in your situation creating a page that does nothing except act a host for the PageMethods would give you flexibility in your design.
I know the language. I've read a book. - _Madmatt
-
daveyerwin wrote:
Did I guess any thing right ?
Only the first one.
daveyerwin wrote:
To do this you can use ScriptManager.GetCurrent(Page);
Has nothing to do with PageMethod
daveyerwin wrote:
Well yeah they need to make a web request I guess.
I'll give you this one also just for stating the blatantly obvious.
daveyerwin wrote:
update panels use what we call ajax so they are just as fast
An ASP.NET UpdatePanel still goes through the page life cycle so yes it can be slow. Making a direct out of band AJAX call is much faster
I know the language. I've read a book. - _Madmatt
Mark Nischalke wrote:
daveyerwin wrote: To do this you can use ScriptManager.GetCurrent(Page); Has nothing to do with PageMethod
thsi has to do with
roguemat wrote:
But I cant find a way that doesnt involve putting code in the main aspx
Mark Nischalke wrote:
An ASP.NET UpdatePanel still goes through the page life cycle so yes it can be slow. Making a direct out of band AJAX call is much faster
The UpdatePanel control represents the nerve center of the server-centric programming model of ASP.NET AJAX. It lets you execute server-side code and return updated markup to the client browser. You may wonder how this differs from classic postbacks. The difference is in how the postback is implemented-instead of a full page refresh, the UpdatePanel control manages to send an out-of-band request for fresh markup and then update the DOM tree when the response is ready. from msdn When, in the page life cycle would this "direct out of band AJAX call" be made ? Oh yeah , thanks for the "blatantly obvious" I'll take it :) edited for formatting
modified on Wednesday, April 21, 2010 11:53 PM
-
Try having a look here, http://www.chadscharf.com/index.php/2009/11/creating-a-page-method-scriptmethod-within-an-ascx-user-control-using-ajax-json-base-classes-and-reflection/[^] However, I would say in your situation creating a page that does nothing except act a host for the PageMethods would give you flexibility in your design.
I know the language. I've read a book. - _Madmatt
Thanks! Seems perfect.
Strive to be humble enough to take advice, and confident enough to do something about it.
-
Mark Nischalke wrote:
daveyerwin wrote: To do this you can use ScriptManager.GetCurrent(Page); Has nothing to do with PageMethod
thsi has to do with
roguemat wrote:
But I cant find a way that doesnt involve putting code in the main aspx
Mark Nischalke wrote:
An ASP.NET UpdatePanel still goes through the page life cycle so yes it can be slow. Making a direct out of band AJAX call is much faster
The UpdatePanel control represents the nerve center of the server-centric programming model of ASP.NET AJAX. It lets you execute server-side code and return updated markup to the client browser. You may wonder how this differs from classic postbacks. The difference is in how the postback is implemented-instead of a full page refresh, the UpdatePanel control manages to send an out-of-band request for fresh markup and then update the DOM tree when the response is ready. from msdn When, in the page life cycle would this "direct out of band AJAX call" be made ? Oh yeah , thanks for the "blatantly obvious" I'll take it :) edited for formatting
modified on Wednesday, April 21, 2010 11:53 PM
Trace through the events that occur when an Update panel is used. From your MSDN lookup, "The difference is in how the postback is implemented". Postback is not eliminated, just modified. On the other hand a direct AJAX call skips it all. Using PageMethod is essentially creating a web service that is hosted by the page and thus skips all the overhead assocaited with UpdatePanel.
I know the language. I've read a book. - _Madmatt
-
Trace through the events that occur when an Update panel is used. From your MSDN lookup, "The difference is in how the postback is implemented". Postback is not eliminated, just modified. On the other hand a direct AJAX call skips it all. Using PageMethod is essentially creating a web service that is hosted by the page and thus skips all the overhead assocaited with UpdatePanel.
I know the language. I've read a book. - _Madmatt
Mark Nischalke wrote:
The difference is in how the postback is implemented".
An update panel does "a direct AJAX call". (how can an indirect call be made ? ) Check and see if updating an update panel calls isPostBack.
Mark Nischalke wrote:
On the other hand a direct AJAX call skips it all.
In order for an ajax call to have an effect on the web page you will have to impliment in your own code that which was "skipped". PostBack is a microsoft invented term which can mean a regular http post request like you would submit to an aspx page or a webservice, it can also mean a direct ajax call. Definition of postback from webopedia ... A mechanism introduced in the Microsoft ASP.NET to allow the communication between client side and server side.
Mark Nischalke wrote:
Postback is not eliminated, just modified.
Here we see that by definition a direct ajax call is cetainly a "postback" which is not eleminated by direct ajax call , just modified. At the bottom of this top heavy pyramid is the XmlHttpRequest object or its activex equivelant. It is used by update panel and by direct ajax call.
-
Mark Nischalke wrote:
The difference is in how the postback is implemented".
An update panel does "a direct AJAX call". (how can an indirect call be made ? ) Check and see if updating an update panel calls isPostBack.
Mark Nischalke wrote:
On the other hand a direct AJAX call skips it all.
In order for an ajax call to have an effect on the web page you will have to impliment in your own code that which was "skipped". PostBack is a microsoft invented term which can mean a regular http post request like you would submit to an aspx page or a webservice, it can also mean a direct ajax call. Definition of postback from webopedia ... A mechanism introduced in the Microsoft ASP.NET to allow the communication between client side and server side.
Mark Nischalke wrote:
Postback is not eliminated, just modified.
Here we see that by definition a direct ajax call is cetainly a "postback" which is not eleminated by direct ajax call , just modified. At the bottom of this top heavy pyramid is the XmlHttpRequest object or its activex equivelant. It is used by update panel and by direct ajax call.
Don't understand what points you are trying to make. We'll just leave it as a misunderstanding in terminology and processes.
I know the language. I've read a book. - _Madmatt
-
Don't understand what points you are trying to make. We'll just leave it as a misunderstanding in terminology and processes.
I know the language. I've read a book. - _Madmatt
Mark Nischalke wrote:
Don't understand what points you are trying to make. We'll just leave it as a misunderstanding in terminology and processes.
I will be more than happy to clear up any misunderstandibgs you may have :)