Sanal.org
till 01th May 2006
Categories
.NET (40)
Art (1)
Blogs (1)
Computers (6)
Information (13)
Internet (11)
Movies (5)
Music (19)
MY SQL (5)
People (16)
Russian (20)
Security (15)
SEO (3)
SQL SERVER (8)
Technology (6)
Turkey (2)
Video (7)
More
TOP 50
Turkish News


Archive
April (2008)
March (2008)
February (2008)
January (2008)
December (2007)
Novamber (2007)
October (2007)
September (2007)
August (2007)
July (2007)
June (2007)
May (2007)
April (2007)
March (2007)
February (2007)
January (2007)
December (2006)
Novamber (2006)
October (2006)
September (2006)
August (2006)
July (2006)
June (2006)
May (2006)
April (2006)
March (2006)
February (2006)
January (2006)
December (2005)
October (2005)
April (2005)
December (1969)

13

ROR
Previous12345Next



Choosing a JavaScript Toolkit For Serious DOM Manipulation

It has finally become clear to me that you can’t get by solely with the MS AJAX Library for sophisticated DOM manipulation. The plumbing is impressive: classes, namespaces, interfaces, enums, etc. However, the Sys.UI.DomElement class doesn’t get you very far. Writing own code to traverse and manipulate DOM gets very boring very fast and is very unproductive.

The AJAX Control Toolkit Common Library

The toolkit relies on a top-notch library full of DOM manipulation goodness. You can find it in AjaxControlToolkit\Common\Common.js. However, it seems to have been written on the go, with functionality put in as needed by involved developers. I may be wrong in my assumption, but I don’t understand why many essential primitives found in other libraries of the same caliber (Prototype, JQuery, Mootools, etc) are missing. Also, common.js doesn’t appear to have been written to be used on its own, but with control extenders only.

JQuery

Once it got tedious to plug holes of the mentioned libraries and write the same code over and over, I decided to look around for a comprehensive library. The usual suspects are Prototype, JQuery, Mootools, and Dojo. I bet you can list a handful more (suggestions?). My goal was to use the MS AJAX Library for plumbing and a toolkit for heavy DOM lifting.

Dojo was disqualified right away. I’m not touching anything ver < 1.0. Even though I used to like Prototype a lot, I dislike its object extension model. I actually like Microsoft’s approach much better.

Mootools is very solid but its DOM querying and traversing capabilities are not up to par with JQuery.

Which leaves JQuery by John Resig. JQuery lets you get away with some pretty insane syntax which surpasses other toolkits, AFAIK. I’ve been able to compress many, many lines of code into one-liners. Also, the community around JQuery has produced a bevy of plugins for all kinds of occasions. The one plugin I like in particular is Interface.

What do you, guys, use?




Pimpin' Validation Summary With CSS

Without any styling applied, ValidationSummary renders as a boring list with error messages. However, it’s easy to pretty it up with some CSS since it’s nothing more than a div with an unordered list inside.

I pretty much always put a validation summary in a master page and assign it a class:

<asp:ValidationSummary runat="server" 
    DisplayMode="BulletList" 
    CssClass="errors" />

Next, I’ll put it in a box with a red border an a humorous picture, plenty of which you can find for $1 at Stockxpert.

.errors {
 border: 2px solid red;
 color: red;
 margin: 5px 0px;
 padding: 15px;
 background: #fff url(../images/sad_server.gif) no-repeat 5px 50%;
}

The background image will appear 5px from the left edge of the summary and will always be centered vertically (it’s the “50%” part up there).

I will also knock out padding and margins on the error list and move it to the right far enough to sit next to the picture of a “sad server”:

.errors ul {
 margin: 0;
 padding: 0;
 margin-left: 80px;
 list-style: square;
}

The end result looks as follows:

Validation summary styled with CSS

There are many other ways to skin a validation summary. For example, if your pages have a fixed-width layout, you can shoot for a background image or two with rounder corners. The sky is the limit, as they say.




Remember to Strongly-Sign Assemblies You Distribute

This has bitten me in the rear a number of times: I download a free/open source/whatever source component, plug it in my project and… Visual Studio complains the assembly is not strongly signed. We always sign our assemblies, so compiling with unsigned ones becomes a problem. We’re lucky if the 3rd party component comes with source code so we can throw in a .snk file and recompile it.

Conventional wisdom says a signature is need only if the assembly goes into GAC. This is correct, but signatures are also a way of disciplined versioning. I understand it’s a point of contention to some people, but I side with proponents of strong signing (Jeffrey Richter, for example).

I’ve been guilty of not following this rule myself, but I became converted once I heard Jeffrey Richter speak on this subject.



Previous12345Next

0.015625


Mysql & .NET & Everything | Kitap | Forum | Haberler | Havacilik | Daily News | Noticias