ASP.NET AJAX [英] ASP.NET Ajax
本文介绍了ASP.NET AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个具有以下原型自定义控件。
I have a custom control that has the following prototype.
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) {
alert(this.get_element().value);
}
}
}
Demo.CustomTextBox.registerClass('Demo.CustomTextBox', Sys.UI.Control);
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
我怎么能提高在_onBlur方法服务器回发事件?
How can i raise a post back event to the server in the _onBlur method?
干杯
罗汉
推荐答案
您可以使用__doPostBack的方法来做到这一点,它有一个签名:
You can use the __doPostBack method to do this, which has a signature of:
function __doPostBack(eventTarget, eventArgument)
因此,这将是沿着线的东西:
So it would be something along the lines of:
__doPostBack(this.get_element().id, 0);
或者你也可以选择通过参数与如果需要事件一起。
Or you can optionally pass an argument along with the event if desired.
这篇关于ASP.NET AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文