See Joel Program

August 7, 2008

Supported Number and DateTime Format Strings in ASP.NET AJAX

Filed under: ASP.NET AJAX — Joel Rumerman @ 11:41 am
We all make mistakes, some are just published in books.

Consider this my first correction to Adam’s and my book: Advanced ASP.NET AJAX Server Controls for .NET 3.5.

In Chapter 6: ASP.NET AJAX Localization, on page 289, we have a tip on Data Format Strings. It states that “the data format strings available for the Date and Number types in JavaScript are the same as those that are available in .NET for the DateTime and Double types.” This is incorrect.
The format strings that are allowed for Number types are the following:

  • c or C: Currency
  • p or P: Percentage
  • d or D“: Decimal (# number of digits)
  • n or N“: Numeric (# number of digits after decimal)

– e, f, g, r, x, and custom format strings are not supported

The standard format strings that are allowed for the Date type are the following:
  • d: Short date pattern
  • D: Long date pattern
  • t: Short time pattern
  • T: Long time pattern
  • F: Full date/time pattern (long time)
  • m or M: Month day pattern
  • s: Sortable date/time pattern
  • y or Y: Year month pattern
– the standard format strings: f, F, g, G, O, o, R, r, u, U are not supported. However, custom format strings that use the “mmm”, “yyyy”, “hh”, etc. formats are supported. You can build your own date format string.

July 31, 2008

A Client Event Pool in JavaScript

Filed under: ASP.NET AJAX — Joel Rumerman @ 9:26 pm

One of the most useful programming concepts that my company has created over the past 16 months is also one of the simplest things that I’ve ever coded. It’s a client-side event pool that lives on the browser and that you interact with through JavaScript.

It’s purpose is simple: to allow arbitrary code to execute when an event is raised. You can think of it as a simple observer pattern implementation.

(You can download the source code here.)

To see just how simple it is, take a look the definition of the ClientEventPool … all 22 lines of it.

_ClientEventPool = function() {
    _ClientEventPool.initializeBase(this, null);
_ClientEventPool.prototype = {
    initialize: function() {
        _ClientEventPool.callBaseMethod(this, 'initialize');
        this._localEvents = this.get_events();
    addEvent: function(eventName, handler) {
        this._localEvents.addHandler(eventName, handler);
    removeEvent: function(eventName, handler) {
        this._localEvents.removeHandler(eventName, handler);
    raiseEvent: function(eventName, sender, args) {
        var h = this._localEvents.getHandler(eventName);
        if (h) {
            h(sender, args);
_ClientEventPool.registerClass("_ClientEventPool", Sys.Component);
window.ClientEventPool = $create(_ClientEventPool, {"id":"ClientEventPool"}, null, null, null);

To use the event pool, I can simply register a handler for the event, and then raise the event like so.

ClientEventPool.addEvent("Test", function(sender, args) { alert("hello!"); });
ClientEventPool.raiseEvent("Test", this, Sys.EventArgs.Empty);

(In case you’re interested, the event pool relies upon ASP.NET AJAX Sys.Component’s .NET-style eventing mechanism, but in reality, using Sys.Component was just a convenience. Because Functions in JavaScript are nothing more than objects, executing functions that are assigned to properties, is really easy and is the concept of .NET delegates, are built into the language. This object could have easily been created without using anything from ASP.NET AJAX.)

(Shameless above-the-fold plug: If you’re a control developer who adds AJAX functionality to their server controls, you might be interested in my new book: Advanced ASP.NET AJAX Server Controls for .NET 3.5. Also, there’s a preview chapter in CoDe magazine.)


July 29, 2008

CoDe Magazine – Book Chapter

Filed under: ASP.NET AJAX — Joel Rumerman @ 7:27 am

Yesterday, CoDe Magazine published Chapter 11: Adding Client Capabilities to Server Controls Using the ASP.NET AJAX Control Toolkit from Adam’s and my book: Advanced ASP.NET AJAX Server Controls for .NET 3.5. Pretty cool stuff!

Check out the free chapter and let us know what you think!

July 28, 2008

Filed under: Searching, Technology — Joel Rumerman @ 7:26 am

It’s rare that anything receives above the fold respect from both and NPR on the same day so when a new search engine, (pronounced Cool) achieved such recognition, I had high hopes for the new search engine.

Here are my initial impressions.

  1. The first time site load was slow even though it’s mainly a single search box. It acted like most other sites do when they get hammered by a lot of web traffic due to a major press day. BUT, it did come up, which is better than a lot of other sites. Subsequent hits were quick as they seemed to cache everything on my browser correctly.
  2. My HCI professor wouldn’t be happy with the black background, but I didn’t mind it so much. It’s a bit different and a bit edgier than they should have gone if they’re trying to attract the main stream search market, but as a tech geek, I’m okay with it.
  3. The search results are laid out in a nice way, but again, took too long to come back. We’re used to Google‘s sub-second search results and frankly, if you want to be a Google killer, you’d better perform as good as they do
  4. The search results are not good. As you know if you my previous post, I recently wrote a book titled “Advanced ASP.NET AJAX Server Controls.” I entered that into the search box and my results were … wait for it … hold … hold … nothing. That’s embarrassing. The book is being sold in multiple countries, by multiple online and brick and mortar websites. Google’s results contain these listings. If you’re going to crawl 120 billion web pages and claim that you’re crawling more information than Google, you need to do a much better job.

Conclusion: I’ll check back in a week and see how it works then, but they just lost the initial round.

July 9, 2008

Advanced ASP.NET AJAX Server Controls for .NET Framework 3.5 Released!

Filed under: AJAX, ASP.NET AJAX, Book — Joel Rumerman @ 1:20 pm

Phew … it’s out.

This past week, Adam’s and my book: Advanced ASP.NET AJAX Server Controls for .NET Framework 3.5 released to online retailers. It should be available in your brick & mortar stores either later this week or earlier next week. If anybody’s got any questions about it, pass them along!!

Advanced ASP.NET AJAX Server Controls

Advanced ASP.NET AJAX Server Controls

June 10, 2008

Update: Fixing Sys.Application.initialize

Filed under: AJAX, ASP.NET AJAX, JavaScript — Joel Rumerman @ 5:41 pm

See this post for the latest solution. This one has a small problem with it.

Yesterday I posted an entry where I wrote about an initialization problem in the AJAX Library portion of ASP.NET AJAX. Today, having a few spare minutes and already having found a few entries on the setTimeout problem which I linked to yesterday, I decided to do a bit more research on the window.onload problem and see how other libraries had gotten around the issue. I started with JQuery because it’s next on my list of AJAX libraries to become familiar with. So I downloaded the library, opened Visual Studio, and took a look around (don’t you love the open source nature of JS?!).


June 8, 2008

When Sys.Application.initialize Causes Operation Aborted in IE

Filed under: AJAX, ASP.NET AJAX, JavaScript — Tags: , , , — Joel Rumerman @ 8:27 pm

As you might already know, I’m a power user of ASP.NET AJAX. I’ve been using it in large commercial projects for over three years and I’ve come to love JavaScript and be somewhat of an ASP.NET AJAX expert. In fact, I even co-authored a book on ASP.NET AJAX Server Control development with my bud Adam Calderon if that helps lend me some credence.


« Newer PostsOlder Posts »

Blog at