This question is directly related to my previous question ASP.NET AJAX
Is it possible to perform the post back asynchronously? I have multiple CustomTextbox controls on the page, when i post back i want to update another control on the form.
If i place all the controls in an updater panel after the first post back to a process that takes a couple of seconds to complete, any changes i have made to other contols rendered with their original values.
Any idea how to fix this?
Type.registerNamespace('Demo');
Demo.CustomTextBox = function(element) {
Demo.CustomTextBox.initializeBase(this, [element]);
}
Demo.CustomTextBox.prototype = {
initialize: function() {
Demo.CustomTextBox.callBaseMethod(this, 'initialize');
this._onblurHandler = Function.createDelegate(this, this._onBlur);
$addHandlers(this.get_element(),
{
'blur': this._onBlur
},
this);
},
dispose: function() {
$clearHandlers(this.get_element());
Demo.CustomTextBox.callBaseMethod(this, 'dispose');
},
_onBlur: function(e) {
if (this.get_element() && !this.get_element().disabled) {
/* Cridit to AdamB for this line of code */
__doPostBack(this.get_element().id, 0);
}
}
}
Demo.CustomTextBox.registerClass('Demo.CustomTextBox', Sys.UI.Control);
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();