Wednesday, February 11, 2009

FileUpload control does not work in Update Panel and workaround

All file upload controls (includes asp, telerik, componentart, component factory and others) does not working in any AJAX update panels. This means if your upload control located in an update panel, control does not post the file. If you look to the posted file property of the control, you will see it null.

This is a limitation comes from the XmlHttpRequest component, used in all AJAX frameworks for asynchronous calls to the application. In order to upload a file you should perform a full page postback.



The key is at the Triggers. Please note this will post a full postback even it's inside a Update Panel.

Solutions are actually available for gmail like async file upload using iframe:
http://vinayakshrestha.wordpress.com/2007/03/13/uploading-files-using-aspnet-ajax-extensions/
http://msmvps.com/blogs/luisabreu/archive/2006/12/14/uploading-files-without-a-full-postback.aspx

Monday, February 2, 2009

OnChange vs. OnExitControl event in SalesLogix

Most of the user input controls have both OnChange and OnExitControl event. If no special reason, OnExitControl event should be handled instead of OnChange.

OnChange event will be fired every single time the user enters anything, but OnExitControl is fired only when user leaves that control, which means user finished data input. It makes more sense to handle the change event after the user is done, instead of in the middle. Especially in the case of date time entry, if users enter date manually instead of picking from the calendar control, the OnChange event will give you the every first number user inputs, which will break your date function.