Showing posts with label rtm. Show all posts
Showing posts with label rtm. Show all posts

Wednesday, March 28, 2012

PageMethods is not defined - Modal Popup

Just upgraded from RC1 to the RTM copy of AJAX and found everything is working for me (with the normal changes to the AutoCompleteExtender) except for my modal popups.

When I attempt to use the client side java script, I get a javascript error:

"PageMethods is not defined."

Here is my JavaScript code:

function myModalPop(regID){ $get("hidRegID").value = regID; PageMethods.popModal(regID, Add_Complete, Add_Timeout, Add_Error);}

and the code behind is:

[System.Web.Services.WebMethod]public static string[] popModal(string regID) { gcmControl DSsend =new gcmControl(); DataSet dsMet =new DataSet(); dsMet = DSsend.gcmDS(dsMet,"SQL","dbAll","SELECT * FROM dbo.tblFinRegister WHERE regID = '" + regID +"' AND clubID = '" + clubID +"'","tblFinRegister"); DataTable tblFinRegister = dsMet.Tables["tblFinRegister"]; DateTime dtRegDate = Convert.ToDateTime(tblFinRegister.Rows[0]["regDate"]);string regDate = dtRegDate.ToString("d");string payeeID = lookupPayee(Convert.ToInt32(tblFinRegister.Rows[0]["payeeID"]));string chartID = tblFinRegister.Rows[0]["chartID"].ToString();string regNumber = tblFinRegister.Rows[0]["regNumber"].ToString();string regPayment;if (tblFinRegister.Rows[0]["regPayment"].ToString() =="0.00") { regPayment =""; }else { regPayment = tblFinRegister.Rows[0]["regPayment"].ToString(); }string regDeposit;if (tblFinRegister.Rows[0]["regDeposit"].ToString() =="0.00") { regDeposit =""; }else { regDeposit = tblFinRegister.Rows[0]["regDeposit"].ToString(); }string regRecon = tblFinRegister.Rows[0]["regRecon"].ToString();string regMemo = tblFinRegister.Rows[0]["regMemo"].ToString();return new string[] { regDate, payeeID, chartID, regNumber, regPayment, regDeposit, regRecon, regMemo }; }
Any suggestions would be fantastic.The way the Toolkit calls page methods is such that no changes are necessary from ASP.NET AJAX RC to 1.0. However, if you're using the ASP.NET AJAX PageMethods wrappers, they made a breaking change such that you now need to set EnablePageMethods=true on your ScriptManager in order to call PageMethods like it seems you're doing above.

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

Saturday, March 24, 2012

PaheMethods is undefined since upgrade to ASP.NET AJAX 1.0

Since I upgraded from the RC to the RTM version, my callbacks fail when invoking the PageMethods. Checking the html, the PageMethods are no longer being declared, hence the error. Any ideas what may have changed since this release?

Since I upgraded from AJAX RC to RTM today, my PageMethod calls no longer work. Looking at the html, they are no longer declared, hence the error. Any one know whats changed to cause this?
Found it. Seems like theEnablePageMethods attribute on the script manager is now required to be set.