Thursday, April 17, 2008

int.Parse throws FormatException without a reason

For few days I've tried to debug a client's problem - int.Parse kept on throwing FormatException when everything was OK.

Finally I found this post, which says - check the regional settings:
Registry: HKEY_CURRENT_USER\Control Panel\International
Key: sPositiveSign (and the negative one).

My client checked both and they were just fine, but I've decided to write my own int.Parse which does this following:

if (str == "0")
return 0;
return int.Parse(str);

This fixed everything (I did the same for double.Parse too).

Friday, April 4, 2008

Hiding/disabling UpdatePanel during update

One of the most common tasks in AJAX is disabling UpdatePanel during AJAX call, i.e:

I expected UpdateProgress to do just that. It doesn't. I searched to web but I only found patches that forced using JavaScript with-in my pages.

Finally I found this (from which I took the image above):

Open source, Ajax.Net only extender, that lets you disable the UpdatePanel and display the UpdateProgress over the disabled control during the update. No JavaScript, just add the control and CSS style.