Showing posts with label upgraded. Show all posts
Showing posts with label upgraded. 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.

Saturday, March 24, 2012

Paging a GridView with CSS Friendly Adapters causes a total postback with AJAX Beta1

Hello,

I have upgraded an existing project (Atlas CTP) to the Atlas Beta1 and encountered a problem with a GridView inside an UpdatePanel. I am using theCSS Friendly ASP.NET 2.0 Control Adapters for the GridView and paging the results causes a total postback instead of partial. Here's my code:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> private System.Collections.Generic.List<string> GetList() { System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(); for (int i = 0; i < 100; i++) { list.Add("item " + i.ToString()); } return list; } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ResultsGrid.DataSource = GetList(); ResultsGrid.DataBind(); } } protected void ResultsGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { ResultsGrid.PageIndex = e.NewPageIndex; ResultsGrid.DataSource = GetList(); ResultsGrid.DataBind(); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:UpdatePanel ID="Updaty" runat="server"> <ContentTemplate> <asp:GridView id="ResultsGrid" runat="server" PageSize="10" AllowPaging="true" OnPageIndexChanging="ResultsGrid_PageIndexChanging" /> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>

Using the Atlas CTP the same code caused a partial postback when paging the GridView. Any ideas?

Regards,
Darin

One way around this is to add a trigger to the UpdatePanel for the PageIndexChanging event.

<Triggers>
<asp:AsyncPostBackTrigger ControlID="ResultsGrid" EventName="PageIndexChanging" />
</Triggers>

I tried this and it seem to then update the panel incrementally as expected.


I posted a fix here...http://forums.asp.net/thread/1442598.aspx

Paging and Sorting in GridView April CTP

Hi,

This start happing only after I upgraded to April release, with March release there was no problem.

I'm using updatepanel and gridview and have a ObjectDataSource which get some QueryStringParameter from the Request. When I'm trying to sort the gridview I'm getting a javascript error saying "Value cannot be null. Parameter name: error.

When trying to debug it I found that when sorting, the request URL got changed, and for example if the URL was :http://mySite.com/Default.aspx?kw=123&from=4/18/2006&to=4/19/2006

It got changed to :http://mySite.com/Default.aspx?kw=123&from=4/18/2006&to=4/19/2006Default.aspx?kw=123&from=4/18/2006&to=4/19/2006

Any thoughts?

Thanks

L

Hi,

I found the cause of the problem.

When ever there is a parameter in the URL that has \ like: &to=4\1\2006&..

Atlas April CTP is going crazy... and can't handle that. I have changed my date format to 4_1_2006 etc. and it's working, but still it's kind of a big deal.

Can any one confirm it's a known bug?

Thanks

Lior

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.

Wednesday, March 21, 2012

Parse Error from ScriptResource.axd in MicrosoftAjax.js

Upgraded to RC1. Works in Firefox for MAC and some MACs with Safari.

But on some Safari installations we are getting Parse Error at line five of MicrosoftAjax.js.

So, basically the entire ATlas package is not being recognized on some Safari installations.

Updatin MAC software on those machines did not help.

Question: Is there a way to create a custom ScriptResource.axd that includes a custom MicrosoftAjax.js?

Thanks in advance.

hello.
scriptresource.axd is a handler used to serve embedded js files. it runs only in the server, so there shouldn't be any issues with it. btw, can you use sniffer and see if you're getting the files correctly from the server?

It is getting to scriptresource.axd allright. It gets a parser error here:

// MicrosoftAjax.js
Function.__typeName="Function";Function.createCallback=function

The app was working with Beta 1.0 of Atlas on those MAC machines.

Failing machines: PowerMac using Safari 1.3.2 and there are no further software updates available from Apple on these machines.

Other MAC machine are still fine.

Will file a bug report with Apple and Microsoft.


Try running the app in debug mode or set ScriptMode="Debug" on the ScriptManager so that the debug scripts are used. That might help show where the error is really occuring.

Thanks,

Eilon