Tuesday, June 17, 2008

UpdatePanel doing full postback when it should not!

I had an UpdatePanel with a Timer for AsyncPostBackTrigger. But although my ScriptManager had EnablePartialRendering="true", my page always got refreshed. The problem was a setting in my web.config. I removed this line:

<xhtmlConformance mode="Legacy"/>

This setting was something that probably I forgot to remove when migrating from asp.net 1.1 to asp.net 2.0.

Monday, June 9, 2008

Javascript dump object

This is a simple javascript function to dump an object:

function dumpObject( object, depth, max )
{
depth = depth || 0;
max = max || 2;

if ( depth > max )
return false;

var indent = \'\';
for ( var i = 0; i < depth; i++ ) indent += \' \';

var output = \'\';
for ( var key in object )
{
output += \'\\n\' + indent + key + \': \';
switch (typeof object[key])
{
case \'object\':
output += dumpObject(object[key], depth + 1, max);
break;

case \'function\':
output += \'function\';
break;

default:
output += object[key];
break;
}
}

return output;
}

Monday, April 21, 2008

Use className="myclass" rather than setAttribute("class", "myclass")

I had to build dynamic html using javascript and I came up with this problem - setAttribute("class", "myclass") didn't work. You should use className instead. The same with setAttribute("onclick","myfunc") - will not work. You should use onclick directly.
eXTReMe Tracker