1: // README
2: //
3: // There are two steps to adding a property:
4: //
5: // 1. Create a member variable to store your property
6: // 2. Add the get_ and set_ accessors for your property
7: //
8: // Remember that both are case sensitive!
9:
10:
11: /// <reference name="MicrosoftAjaxTimer.debug.js" />
12: /// <reference name="MicrosoftAjaxWebForms.debug.js" />
13: /// <reference name="AjaxControlToolkit.ExtenderBase.BaseScripts.js" assembly="AjaxControlToolkit" />
14:
15:
16: Type.registerNamespace('AJAXControls.CharacterCounter');
17:
18: AJAXControls.CharacterCounter.CharacterCounterBehavior = function(element) {
19: AJAXControls.CharacterCounter.CharacterCounterBehavior.initializeBase(this, [element]);
20:
21: // TODO : (Step 1) Add your property variables here
22: this._UpdateControlIDValue = null;
23: this._MaxCharactersValue = 0;
24: }
25: AJAXControls.CharacterCounter.CharacterCounterBehavior.prototype = {
26: initialize: function() {
27: AJAXControls.CharacterCounter.CharacterCounterBehavior.callBaseMethod(this, 'initialize');
28:
29: // TODO: Add your initalization code here
30: Sys.UI.DomEvent.addHandler(this.get_element(), 'keyup',
31: Function.createDelegate(this, this._onkeyup));
32: if (this._MaxCharactersValue != 0) {
33: $get(this._UpdateControlIDValue).innerHTML = this._MaxCharactersValue;
34: }
35: else {
36: $get(this._UpdateControlIDValue).innerHTML = this.get_element().value.length;
37: }
38: },
39:
40: _onkeyup: function() {
41: if (this._MaxCharactersValue != 0) {
42: $get(this._UpdateControlIDValue).innerHTML = this._MaxCharactersValue - this.get_element().value.length;
43: }
44: else {
45: $get(this._UpdateControlIDValue).innerHTML = this.get_element().value.length;
46: }
47: },
48:
49: dispose: function() {
50: // TODO: Add your cleanup code here
51:
52: AJAXControls.CharacterCounter.CharacterCounterBehavior.callBaseMethod(this, 'dispose');
53: },
54:
55: // TODO: (Step 2) Add your property accessors here
56: get_UpdateControlID: function() {
57: return this._UpdateControlIDValue;
58: },
59:
60: set_UpdateControlID: function(value) {
61: this._UpdateControlIDValue = value;
62: },
63: get_MaxCharacters: function() {
64: return this._MaxCharactersValue;
65: },
66:
67: set_MaxCharacters: function(value) {
68: this._MaxCharactersValue = value;
69: }
70: }
71: AJAXControls.CharacterCounter.CharacterCounterBehavior.registerClass('AJAXControls.CharacterCounter.CharacterCounterBehavior', AjaxControlToolkit.BehaviorBase);