2009-02-10 4 views
2

Контроль рейтинга в инструменте управления ajax не будет увеличивать событие, если пользователь нажимает на текущую рейтинговую звезду, потому что в поведении js он имеет проверку if (this._ratingValue! = This._currentRating), поэтому я хочу переопределить этот метод без изменения js и построения takeit. Как я могу это сделать, могу ли я увеличить контроль над рейтингами и переоценить RatingBehavior.js или любое другое решение.Ajax control toolkit 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

Смежные вопросы