﻿Type.registerNamespace("AjaxControlToolkit");AjaxControlToolkit.DynamicPopulateBehavior=function(A){AjaxControlToolkit.DynamicPopulateBehavior.initializeBase(this,[A]);this._servicePath=null;this._serviceMethod=null;this._contextKey=null;this._cacheDynamicResults=false;this._populateTriggerID=null;this._setUpdatingCssClass=null;this._clearDuringUpdate=true;this._customScript=null;this._clickHandler=null;this._callID=0;this._currentCallID=-1;this._populated=false};AjaxControlToolkit.DynamicPopulateBehavior.prototype={initialize:function(){AjaxControlToolkit.DynamicPopulateBehavior.callBaseMethod(this,"initialize");$common.prepareHiddenElementForATDeviceUpdate();if(this._populateTriggerID){var A=$get(this._populateTriggerID);if(A){this._clickHandler=Function.createDelegate(this,this._onPopulateTriggerClick);$addHandler(A,"click",this._clickHandler)}}},dispose:function(){if(this._populateTriggerID&&this._clickHandler){var A=$get(this._populateTriggerID);if(A){$removeHandler(A,"click",this._clickHandler)}this._populateTriggerID=null;this._clickHandler=null}AjaxControlToolkit.DynamicPopulateBehavior.callBaseMethod(this,"dispose")},populate:function(contextKey){if(this._populated&&this._cacheDynamicResults){return }if(this._currentCallID==-1){var eventArgs=new Sys.CancelEventArgs();this.raisePopulating(eventArgs);if(eventArgs.get_cancel()){return }this._setUpdating(true)}if(this._customScript){var scriptResult=eval(this._customScript);this.get_element().innerHTML=scriptResult;this._setUpdating(false)}else{this._currentCallID=++this._callID;if(this._servicePath&&this._serviceMethod){Sys.Net.WebServiceProxy.invoke(this._servicePath,this._serviceMethod,false,{contextKey:(contextKey?contextKey:this._contextKey)},Function.createDelegate(this,this._onMethodComplete),Function.createDelegate(this,this._onMethodError),this._currentCallID);$common.updateFormToRefreshATDeviceBuffer()}}},_onMethodComplete:function(A,D,B){if(D!=this._currentCallID){return }var C=this.get_element();if(C){C.innerHTML=A}this._setUpdating(false)},_onMethodError:function(A,D,B){if(D!=this._currentCallID){return }var C=this.get_element();if(C){if(A.get_timedOut()){C.innerHTML=AjaxControlToolkit.Resources.DynamicPopulate_WebServiceTimeout}else{C.innerHTML=String.format(AjaxControlToolkit.Resources.DynamicPopulate_WebServiceError,A.get_statusCode())}}this._setUpdating(false)},_onPopulateTriggerClick:function(){this.populate(this._contextKey)},_setUpdating:function(A){this.setStyle(A);if(!A){this._currentCallID=-1;this._populated=true;this.raisePopulated(this,Sys.EventArgs.Empty)}},setStyle:function(A){var B=this.get_element();if(this._setUpdatingCssClass){if(!A){B.className=this._oldCss;this._oldCss=null}else{this._oldCss=B.className;B.className=this._setUpdatingCssClass}}if(A&&this._clearDuringUpdate){B.innerHTML=""}},get_ClearContentsDuringUpdate:function(){return this._clearDuringUpdate},set_ClearContentsDuringUpdate:function(A){if(this._clearDuringUpdate!=A){this._clearDuringUpdate=A;this.raisePropertyChanged("ClearContentsDuringUpdate")}},get_ContextKey:function(){return this._contextKey},set_ContextKey:function(A){if(this._contextKey!=A){this._contextKey=A;this.raisePropertyChanged("ContextKey")}},get_PopulateTriggerID:function(){return this._populateTriggerID},set_PopulateTriggerID:function(A){if(this._populateTriggerID!=A){this._populateTriggerID=A;this.raisePropertyChanged("PopulateTriggerID")}},get_ServicePath:function(){return this._servicePath},set_ServicePath:function(A){if(this._servicePath!=A){this._servicePath=A;this.raisePropertyChanged("ServicePath")}},get_ServiceMethod:function(){return this._serviceMethod},set_ServiceMethod:function(A){if(this._serviceMethod!=A){this._serviceMethod=A;this.raisePropertyChanged("ServiceMethod")}},get_cacheDynamicResults:function(){return this._cacheDynamicResults},set_cacheDynamicResults:function(A){if(this._cacheDynamicResults!=A){this._cacheDynamicResults=A;this.raisePropertyChanged("cacheDynamicResults")}},get_UpdatingCssClass:function(){return this._setUpdatingCssClass},set_UpdatingCssClass:function(A){if(this._setUpdatingCssClass!=A){this._setUpdatingCssClass=A;this.raisePropertyChanged("UpdatingCssClass")}},get_CustomScript:function(){return this._customScript},set_CustomScript:function(A){if(this._customScript!=A){this._customScript=A;this.raisePropertyChanged("CustomScript")}},add_populating:function(A){this.get_events().addHandler("populating",A)},remove_populating:function(A){this.get_events().removeHandler("populating",A)},raisePopulating:function(A){var B=this.get_events().getHandler("populating");if(B){B(this,A)}},add_populated:function(A){this.get_events().addHandler("populated",A)},remove_populated:function(A){this.get_events().removeHandler("populated",A)},raisePopulated:function(A){var B=this.get_events().getHandler("populated");if(B){B(this,A)}}};AjaxControlToolkit.DynamicPopulateBehavior.registerClass("AjaxControlToolkit.DynamicPopulateBehavior",AjaxControlToolkit.BehaviorBase);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();