I will be publishing my first version of the Inline-Edit control on October 4, 2007 on www.aspalliance.com. That control is based on another non-ASP.NET AJAX control. So two days ago I started working on a new version of the Inline-Edit control that is purely an ASP.NET AJAX Control.
I noticed something very nice to share:
When you define private fields in AJAX inside the class constructor and add to it the set/get methods, as properties, then if you don't provide values for these two properties when you use the $create method to create a new instance of that control, the set methods are never called.
However, sometimes you might need to give some initialization values for those private fields, so where is the best place to do so? I thought of using the getters and setters but as I explained above, it doesn't help.
What you can do is simply provide the initialization data inside the constructor as the following:
Bhaidar.AJAX.Controls.InlineEditLabel = function(element) {
Bhaidar.AJAX.Controls.InlineEditLabel.initializeBase(this, [element]);
this._toolTip= '';
this._updateButtonText = 'Update';
}
The above sample code is part of the new inline-edit control I am developing. So now, even if the developer didn't provide some text to the updateButonText, she will be able to show the default text specified in the constructor.
Hope this helps,
Regards
Tags: