c# - Page Methods throwing Undefined -
i trying use page methods call function , getting "pagemethods undefinded" error. have used them before whilst using c# not vb i'm wondering if syntax wrong examples can find c#. wondering if it's because scriptmanager on master page?
i've read error everywhere have appears correct!
can point me @ doing wrong?
thanks!
my code:
part of master page
<form id="form1" runat="server"> <asp:scriptmanager id="scriptmanager1" runat="server" enablepartialrendering="true" enablepagemethods="true" > </asp:scriptmanager> <div id="header">~~~~~
content page html
<asp:content id="content1" contentplaceholderid="head" runat="server"> <script type="text/javascript"> function selectzones(commaseparatedlist){ pagemethods.zones(commaseparatedlist); } </script> </asp:content> <asp:content id="content2" contentplaceholderid="navigationplaceholder" runat="server"> </asp:content> <asp:content id="content3" contentplaceholderid="contentbodyplaceholder" runat="server"> <a href='' onclick='selectzones("blah,blah,blah"); return false;'>click here</a> </asp:content> <asp:content id="content4" contentplaceholderid="functionsmenuplaceholder" runat="server"> </asp:content>
content page code behind
imports system.web.services public class testclass inherits baseclass protected sub page_load(byval sender object, byval e system.eventargs) handles me.load end sub <webmethod()> protected shared sub zones(byval zones string) httpcontext.current.response.write("test = " & zones) end sub end class
i believe have issue "selectzones" method running before scripts script manager completing run. suggest try put call document ready or event , see if call works @ time. scripts run when seen client browser, , if downloaded script manager other scripts later in page run first.
Comments
Post a Comment