Saturday, June 27, 2009

Summary of interfaces in 3.5 .NET framework IEnumerable, IQueryable and IList

IEnumerable - supports being used in a foreach statement and that's about it.
IQueryable - supports further filtering, paging, etc. Does not support random access via an indexer. Implements IEnumerable
IList - supports random access via an indexer. does not support further filtering. Implements IEnumerable

Tuesday, June 23, 2009

Ajax survey 2009: jQuery and MS Ajax are almost tied among .NET developers

Source
The most used Ajax/JS library among .NET developers is jQuery, which is used by the 71,4% of the users. Second comes the Ajax Control Toolkit with 58,8%, followed by the core ASP.NET Ajax library, which is used by 44,8%.

Friday, June 19, 2009

Browser type in JQuery with source code

var userAgent = navigator.userAgent.toLowerCase();

// Figure out what browser is being used
jQuery.browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
safari: /webkit/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};


//Syntax: RegExpObject.test(string)

Friday, June 12, 2009

What ASP.NET Developers Should Know About jQuery

Source

........
Use selectors. Think in sets.
In the ASP.NET world, it’s rare to select sets of controls through queries. Instead, we’re accustomed to referencing a single control by its unique ID. Of course this is possible in jQuery too, but its selector engine is far more sophisticated.

Using selectors to identify a set of one or more elements is cleaner and more expressive than the iterative machinations you may be used to in ASP.NET server-side code. Before parsing out an ID or iterating over a group of elements in search of certain ones, be sure that the task isn’t more easily accomplished through a jQuery selector.

Use CSS classes for more than just styling.
Another technique that is counterintuitive at first is the use of CSS classes as flags. Coupled with jQuery’s selector engine, “flag” classes are surprisingly powerful.
............

Friday, June 5, 2009

undefined and null are same in Javascript with sample code

undefined is a global property (variable) with a constant value. Javascript treats undefined as being equal to null.
Sample code
<html>
<body>

<script type="text/javascript">
var test;
if (test==null)
{
alert("null");
}

if (test==undefined)
{
alert("undefined");
}
</script>

</body>
</html>