Wednesday, March 28, 2012

ASP.NET AJAX Sample applications - SimpleList

Hi,

I also just started learning ASP.NET AJAX for real and I wanted to check out theSamples that one can download. I thought using the SimpleList would be the easiest but I soon found out that when you want to run the DragOverlayExtender began complaining. Seemed the web.config isn't complete. I added these extra lines in order to get it to work:

 <profile> <properties> <add name="dragOverlayPosition"/> </properties> </profile>

and

 <profileService enabled="true" readAccessProperties="dragOverlayPosition" writeAccessProperties="dragOverlayPosition" />

I hope this helps other people out that are just starting to play around with the samples

If you like to read more about it...

Grz, Kris.

Thanks for sharing Kris...Please continue to do so.

Salute,

Mark Wisecarver

asp.net ajax refresh the UpdatePanel every 30 sec?

I am currently using Timer control inside my update panel to update automatically every 30 sec. However i wanted to use json to do the same thing.

Any suggestions?

Thanks

Hi,

JSON (JavaScript Object Notation) is a lightweight data-interchange format, or it can be viewed as a protocal defining how object is serialized when transporting.

It can't be used to perform actions at a certain interval like Timer.

Please refer to this for more information:http://msdn2.microsoft.com/en-us/library/bb299886.aspx

Hope this helps.

ASP.NET AJAX RC on PROD server is not working

Hi

I have a sample ASP.NET AJAX application built using ASP.NET AJAX RC. it AJAXes and it does behave as expected on VS 2005. When i deployed it on my local server. It does not AJAX and get the following javascript error

Error:'Sys' is undefined

am running XP Pro, SP2 & IIS 5.1. earlier i had not installed any beta releases or ATLAS. i dont see what is going on.

thanks in advance for the help

Anil

7 pages of posts just like this, lots of solutions and things to try in there

http://forums.asp.net/thread/1498667.aspx

ASP.NET Ajax Progress Bar Revisited

I'm trying to create a Progress Bar that keeps track of a long running server-side process. I'm attempting to do this by having a primary ajax request start the server-side process, then having another polling function occassionally call back to the server via ajax to return the status if the server-side process started with the first ajax call. The problem is that the second ajax call doesn't return until the first one is completed.

Consider the following client-side code:

PageMethods.Execute(ExecuteCallback);

intervalId = window.setInterval(ExecuteStatus, 1000);
var done = false;

function ExecuteStatus()
{
PageMethods.ExecuteStatus(ExecuteStatusCallback);
}

function ExecuteStatusCallback( status )
{
<update progress bar>
if( !done )
window.setInterval( ExecuteStatus, 1000 );
}

function ExecuteCallback()
{
done = true;
}

PageMethods.Execute() is a server side process that can take a considerable amount of time. As it executes, it is setting a Session variable which indicates the status and completion percent of the process.

PageMethods.GetStatus() is a simple server side function which reads the aformentioned Session variable, and returns the status to the client.

The problem is that PageMethods.GetStatus() doesn't return until PageMethods.Execute() has completed and called back to the client.

Any ideas how to make this work?

Thanks much,

- Stew

I think you mean setTimeout instead of setInterval. Here's a working example. I hope this helps!

<%@. Page Language="C#" %><%@. Import Namespace="System.Web.Services" %><%@. Import Namespace="System.Threading" %><script runat="server"> [WebMethod] public static void Execute() { Thread.Sleep(5000); } [WebMethod] public static string ExecuteStatus() { return "."; }</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="sm" runat="server" /> <input type="button" value="Execute" onclick="DoExecute(); return false;" /> <span id="status">Ready.</span> </form></body><script type="text/javascript"> var done = false; function ExecuteStatus() { PageMethods.ExecuteStatus(function (result) { if (done) { $get('status').innerHTML = "Done!"; } else { $get('status').innerHTML += result; window.setTimeout(ExecuteStatus, 1000); } }); } function DoExecute() { done = false; PageMethods.Execute(function () { done = true; }); $get('status').innerHTML = 'Executing'; window.setTimeout(ExecuteStatus, 1000); }</script></html>

Steve, thanks for the response. Yes I did use setTimeout; I made a mistake when I typed the message above. I'm not sure why your test would work and not mine, but I'll take a look when I get home on Monday.

Thanks again

- Stew


Steve,

Try setting a session variable in your test before executing the test. This is what appears to be causing the problem.

- Stew

ASP.NET Ajax Probelm

has anyone else tried viewing a page that has an updatepanel in different browsers like Opera. It doesn't work I get the following exception

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

might be something that the team wants to look into. I dont' have a probelm with firefox or netscape

hello.

if i'm not wrong, opera isn't fully supported yet (though i'm really hoping that it is when the release version gets out)

ASP.NET AJAX PageMethods

I would like to call a server side method from javascript, and have read that this is where PageMethods comes into the picture.

I would like to call my method when a Virtual Earth map onLoad event has fired.

I have problems with PageMethods as the method called serverside has to be shared and therefore i cannot reference my controls.

Is there other options ?

You can't access page controls in a page method, because a page method request doesn't transmit ViewState or run through the page life-cycle to create the controls.

If you really need to reference the controls, you canuse an UpdatePanel and __doPostBack to trigger a partial postback (which does allow you to reference the controls).


You can also pass clientside state through parameters if needed.

ASP.NET AJAX on non-Windows platform

There is a strong implication that ASP AJAX can be used on a non-Windows platform, such as Linux. I downloaded the .zip file and un-zipped it. The resulting JavaScript is tightly compressed and thus unreadable. Where can I find the API (loosely speaking); or, in other words, how can I use it?

Hi,

the Microsoft AJAX Library, just a zip file with several .js files in it, contain the client sideframework of ASP.NET AJAX. All the .js files also come with their debug counterpart which have .debug.js in their name.

Maybe some interesting article for you is to usePHP together with the Microsoft AJAX Library.

Grz, Kris.


Thank you. The info in that article was the missing link. I've yet to try it, but I'm sure it will work.

Now that I've had time to check it out, that paper is a little too simplistic. I downloaded and ran the PHP samples, and once I figured out how to tell my web host that it was PHP 5, not 4, they ran just fine.

Unfortunately, I don't know how to move beyond the simple "Hello World" page to somthing more useful.Some explanation of what's going on in HelloService.php and PersonService.php would be very helpful. Or how about converting the ToDoList demo to PHP MS AJAX? That would offer some meat to chew on.

Thanks in advance for the help!