1

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();

How can i raise a post back event to the server in the _onBlur method?

Cheers

Rohan

Zain Shaikh
6,0636 gold badges45 silver badges67 bronze badges
asked Nov 18, 2008 at 20:36
1
  • Updating the question title to describe the question (instead of just ASP.NET Ajax) would probably gather more views/answers Commented Nov 18, 2008 at 20:56

1 Answer 1

5

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.

answered Nov 18, 2008 at 21:14
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.