2009-02-10 4 views
2

ajax 컨트롤 툴킷의 등급 컨트롤은 동작 등급 j에서 사용자가 현재 등급 스타를 클릭하면 이벤트를 발생시키지 않습니다. if (this._ratingValue! = this._currentRating), 그래서 js 변경 및 건물 takeits 않고이 메서드를 재정의 할 싶습니다. 어떻게 할 수 있습니까? 평가 제어를 확장하고 RatingBehavior.js 또는 다른 솔루션을 대체 할 수 있습니까?Ajax 컨트롤 툴킷 Rating Control- Override RatingBehavior.js

_onStarClick : function(e) { 
     /// <summary> 
     /// Handler for a star's click event 
     /// </summary> 
     /// <param name="e" type="Sys.UI.DomEvent"> 
     /// Event info 
     /// </param> 
     if (this._readOnly) { 
      return; 
     } 
     if (this._ratingValue != this._currentRating) { 
      this.set_Rating(this._currentRating); 
     } 
    }, 

답변

3

난 그냥 시도

function AddNewRatingHandler() { 

     AjaxControlToolkit.RatingBehavior.prototype._onStarClick = 
      function(e) { 
       if (this._readOnly) { 
        return; 
       } 
       // if (this._ratingValue != this._currentRating) {      
       this.set_Rating(this._currentRating); 
       // } 
      }; 
      AjaxControlToolkit.RatingBehavior.prototype.set_Rating = function(value) {      
       // if (this._ratingValue != value) { 
       this._ratingValue = value; 
       this._currentRating = value; 
       if (this.get_isInitialized()) { 
        if ((value < 0) || (value > this._maxRatingValue)) { 
         return; 
        } 

        this._update(); 

        AjaxControlToolkit.RatingBehavior.callBaseMethod(this, 'set_ClientState', [this._ratingValue]); 
        this.raisePropertyChanged('Rating'); 
        this.raiseRated(this._currentRating); 
        this._waitingMode(true); 

        var args = this._currentRating + ";" + this._tag; 
        var id = this._callbackID; 

        if (this._autoPostBack) { 
         __doPostBack(id, args); 
        } 
        else { 
         WebForm_DoCallback(id, args, this._receiveServerData, this, this._onError, true) 
        } 

       } 
       // } 
      };     
    } 
    AddNewRatingHandler(); 

</script> 



</div> 

</form> 
+0

이 일을하지만, 어떤 영향을 미칠 것 같지 않습니다 위의 코드를 넣어 그것을 해결했다. aspx 페이지에이 코드를 추가하는 것 외에 다른 작업이 필요합니까? – merk

관련 문제