asp.net - javascript inside Usercontrol inside updatepanel is undefined -
i'm facing little problem here :
i have aspx page contains update panel has place holder (in content template) containing different usercontrols show/hide depending on conditions.
one of them has long script inside initializing function has controls retrieved server tags ( <% #myctrl.clientid%>) values etc.. , thing when call function once updatepanel finishes updating, says it's undefined..
as if usercontrol script wasn't seen @ all,
here aspx page "initializefees" function call when update finished:
<asp:scriptmanager id="scriptmanager1" runat="server" enablepartialrendering="true" enablepagemethods="true"> <asp:updatepanel runat="server"> <contenttemplate> <script type="text/javascript"> sys.webforms.pagerequestmanager.getinstance().add_endrequest(initializefees); </script> <div class="registration_progresscontent"> <uc3:ctrl_registrationprogress id="ctrl_registrationprogress1" runat="server" onselectedindexchanged="changestep" /> </div> </div> <div class="registration_stepcontent"> <asp:placeholder runat="server"> <uc1:ctrl_registrationgeneral id="ctrl_registrationgeneral1" runat="server" visible="false" /> <uc4:ctrl_registrationfee id="ctrl_registrationfee1" runat="server" visible="false" />
and here "uc4:ctrl_registrationfee" html code :
<%@ control language="vb" autoeventwireup="false" codebehind="ctrl_registrationfee.ascx.vb" inherits="mdsinscription.ctrl_registrationfee" %> <script type="text/javascript"> //validateurs var valteam; var valemail; var imgname; function initializefees() { valteam = $('#valcreateteamname'); valemail = $('#valcreateemail'); $("#accordion").accordion({ //activate: function (event, ui) { // // validateselection(); //} });
with code behind (vb.net.....#joy..) :
private sub page_prerender(byval sender object, byval e system.eventargs) handles me.prerender scriptmanager.registerclientscriptblock(me, page.gettype(), "init", "initializefees();", true) end sub
this code got after searching more hour, , following error :
uncaught referenceerror: initializefees not defined
if feel can help, thanx !
problem solved following script, put outside update panel :
function pageload() { $(".datepicker").datepicker({ changemonth: true, changeyear: true, mindate: "-100y", maxdate: "-15y", dateformat: "dd/mm/yy", yearrange: "1913:2300" }); //more code executed on each postback update panel ... }
Comments
Post a Comment