Showing posts with label appear. Show all posts
Showing posts with label appear. Show all posts

Wednesday, March 28, 2012

PageMethods in UserControl

Sorry if this has been asked before, but the search on the forum does not appear to be working. Everything returns "no results" even a search on "atlas"Smile [:)].

Anyway, is it possible to have web methods in a usercontrol and call them from javacript. I have successfully implemented the PageMethods.SomeMethod from a page but not from a User Control.

Anyone know how to do this?

Thanks,

Joe

No, PageMethods on user controls are not supported.


Will PageMethods be supported the future. I was planning on using PageMethods in controls, to me this would make sense to have.

Thanks.

hello.

i'm tented to say that it won't happen...though i might be wrong...


If there is some callback functionality that you need to use on different pages throughout your site, the best way forward would be to use the asmx web service model. This is much easier than it sounds, and the tutorial is great.

This model is more efficient than PageMethods, where ASP.NET has to initialise a Page instance from viewstate/http to get access to the method you need.

It seems to me that UpdatePanel and PageMethods have been included primarily because of ease of integration into existing sites. If you have the time to optimise, however, then the web service model is the way to go...

Cheers,
Carlos
Hi, thanks for the informaiton. can you send me an example how to use webservice model with user controls..

Monday, March 26, 2012

PageMethods object missing in RTM?

I tried to convert some code from the last RC to the RTM version that called PageMethods.MyMethod(), but the PageMethods object doesn't appear to be working anymore.

I started out with a fresh web.config from the RTM bits, so I know this isn't the problem.

I'm also hear anecdotally from other colleagues that the UpdatePanel control isn't working, or isn't working the way it did in the last RC.

Any feedback would be appreciated.

Hi Look at the following post:

http://forums.asp.net/thread/1545311.aspx

You need to set EnablePageMethods property of ScriptManager to true.


Sure enough. That did the trick.

Thanks for the tip!Wink


Sure enough. That did the trick.

Thanks for the tip!Wink