Pagemethods with AJAX

  • Thread starter Thread starter George Ter-Saakov
  • Start date Start date
G

George Ter-Saakov

People, I am going crazy already

I have a page default.aspx where i am using Page Methods. Evetrything works
fine.
Now i want to create second page default2.aspx. in the same project/same
folder.
It gives me a JavaScript error PageMethods not defined.

I copied (CNTRL+A, CNTRL+C, CNTRL+A, CNTRL+V) everything from default1.aspx
into default2.aspx (no code behind).

Still not working. When i look at the source in HTML of default.aspx, line
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods=true
/>

generates PageMethods declaration in javascript.

When i am looking at the source of default2.aspx it's not there (although
ScriptManager line is in aspx with EnablePageMethods=true).



What am I missing? What could be the reason PageMethods not being defined.

thanks

George.
 
Well, found an answer.

1. the PageMethod must be declared as public static. Otherwise it will not
work. No errors except it gives PageMethods is not defined.
2. Project must be completely rebuild: menu/Rebuild Website. Otherwise it
will not work.


George.
 
Back
Top