DCSIMG
Ajax - Pini Dayan

Pini Dayan

The best thing about a boolean is even if you are wrong, you are only off by a bit.

Browse by Tags

All Tags » Ajax (RSS)
ASP.NET Ajax 4/3.5 CDN support
Today I found out a cool nice thing. As we all know Microsoft ASP.NET Ajax 4.0 is shipped with the new caching support for the JS library it uses. This feature is called the CDN and basically it is working and increasing performance by spreading lots of servers around the world that store JS files like the ASP.NET Ajax 4.0 and the Jquery library files. From Microsoft: “By taking advantage of the Microsoft Ajax CDN, you can significantly improve the performance of your Ajax applications. The contents...
Adding/Firing custom event using JavaScript
Today I found out a very cool way for adding custom events and fire them for any Client side object. This can be done using ASP.NET Ajax very easily. (Thank you Igor). In order to create these events and fire them we will use the Sys.EventHandlerList Class . This class Creates a dictionary of client events for a component, with event names as keys and the associated handlers as values. It’s main method we need are the addHandler and getHandler. Lets see a simple example which is pretty self explanatory...
Ever forgot “alert()” when deployed to production
As developers we often forget to remove debug code on the client side such as “alert” calls , “debugger” statements and so on. So in order to avoid our team leader throw a chair at us here is a simple solution to this problem: On the page startup ( page load or when ever you find it necessary) simply override the alert method like this: Set alert to work only in debug var originalAler = window.alert; window.alert = function (message) { if (Sys.Debug.isDebug) {    originalAler(message);...
Ajax ToolKit:Fix ResizableControl handler position problem
One of the controls available in the Ajax ToolKit is the ResizableControlExtender which makes a panel (div) resizable. One of the major bugs this control has his the ability to set the location for the handler (The place holder for the mouse with the resize cursor) to the left bottom corner of the ResizableControl target. There are many solutions out there , but as I tried them most of them simply do not solve the problem. After downloading the ResizableControlBehavior.js file and learning how it...
Ajax Tip: Set position for ModalPopupExtender
Hi all, Ever wanted to set the location of the Modal windows you open using the ModalPopupExtender available when using ASP.NET Ajax toolkit? Well there is a very simple way to do it using BLOCKED SCRIPT 1. Get the position you want the modal window to show. You can do it using ASP.NET Ajax library using Sys.UI.DomElement.getLocation method like this: var location = Sys.UI.DomElement.getLocation($get( "div1" )); In this case I used some div control to set the modal windows next to it. 2...
Microsoft ASP.NET Ajax DOM Events
Hi all, Lately I add to deal with a lot of cross browser stuff (Needless to say is is very ugly and in frustration times I wish we only had IE :-) ) Anyway , one cool way to solve lots of these issues is of course to use a Framework that does all the Cross browser JS for you.I am using Microsoft ASP.NET Ajax Library. Here is a nice example of how to handle mouse clicks in a way that will work on IE, Chrome and Firefox. When trying to work with the mouse event (And writing cross browser code) you...
RoundedCorners control – how does it really work?
ASP.NET Ajax toolkit has many cool controls, one of them is the RoundedCorners control. I think any ASP.NET developer meets the problem of how to create a control with rounded corners sometime during his career. Most of us solve this issue using images by creating 4 images , one for each corner. Here is a good example of how to achieve this using image and table. There is another solution that is not yet cross browser one. there is the css 3 new upcoming feature for giving each control a raduis....
Building ASP.NET Real – time web application – Part 5
After seeing the core of the real-time solution in post 1 – 4 this post will show the other code parts and specify a few details and steps we can take to optimize the solution: So here are the missing codes to complete the puzzle: The StocksValuesDB class, that simulate a DB being updated in each interval and has an event to tell clients when an update occurs: public class StocksValuesDB { //The event this DB raised when the data changes public delegate void StocksChangedDeleaget ( StocksEventArgs...
Building ASP.NET Real – time web application – Part 4
In the previous post, I explained how to use the HTTP Async handler (or simply Async page) in order to create a callback and store it somewhere. Later when something changes this callback will be invoked and update the web client waiting for update. But what is this callback ,how do we get it invoked and what is BeinXXX and EndXXX in this post: Asynchronous Programming Model: When an application performs an IO operation, the application is very much depend on the device that is doing this IO work...
Building ASP.NET Real – time web application – Part 3
In part 2 of these series of posts , I showed the basics of building the UI for the page and the JavaScript for calling the server using AJAX and waiting for a response. But how did I make the HTTP request “wait” and let the server “wake” it up? The answer is very simple. Async page (or Async HTTP Handlers). Here is a simple explanation from MSDN: “When ASP.NET receives a request for a page, it grabs a thread from a thread pool and assigns that request to the thread. A normal, or synchronous, page...
Building ASP.NET Real – time web application – Part 2
In the previous post , I wrote the general steps to accomplish the solution of achieving real time web application. In this post we will start and demonstrate the solution step by step and explain the application blocks of the solution from building the simple UI for this sample project and moving forward to the hardcode parts of the solution, so without further ado lets start. The demo code can be downloaded from here . (It is a web application solution that runs and works without a DB, but instead...
Building ASP.NET Real – time web application
What if we could write a web application that it’s clients (browsers in our case) can get notified in case of something happening in the server, like a DB row added/changed, a BL entity (from any object model you have built ) raising an event or anything you can come up with in your mind. To clarify things let me further explain by using a very simple example : Say you have a web page (aspx, html, or any other) that displays a various stocks values in a grid, these values are changing very fast and...
Advanced JavaScript Open House
Hi all, As I promised, I am uploading the presentation and source files from the Open day at Sela this week. In these files you can see the source code of the samples we showed in class and the slides which are a good reference to the highlight of this day. Than you all for participating... Download
IE 8 new Feature for working with JSON
When I am lecturing "Microsoft Ajax" and I need to show some Ajax sample that uses JSON I explain to my students that they need to download some js files and place them in the web site in order for them to work with JSON in the client side. When I am referring to working with JSON I usually mean 3 things: 1. Converting a string into a JSON object. 2. Converting an existing object into it's JSON string representation. 3. Converting an XML string into JSON object. So for the first 2 I...
IE 8 Connectivity Enhancements
If you ask any .NET developer what is the number of http requests you can send to a given server at once - he will answer 2. He will be even more sure if he wrote some ajax pages or even worked with Microsoft Ajax. Well as it turns out this answer is not correct. and especially not true in case of IE 8. As it turns out , when we are using IE 8 , rather its an HTTP 1.0 or HTTP 1.1 request we can now use 6 concurrent connections to the same server. Here is a summary table from the msdn site: The limitation...
More Posts Next page »