2009-02-10 6 views
2

Le contrôle d'évaluation dans la boîte à outils de contrôle ajax n'augmente pas l'événement si l'utilisateur clique sur l'étoile actuelle car il vérifie if (this._ratingValue! = This._currentRating), donc je veux passer outre cette méthode sans changer js et construire takeit. Comment puis-je le faire, puis-je étendre le contrôle d'évaluation et surpasser RatingBehavior.js ou toute autre solution.Boîte à outils de contrôle Ajax Contrôle de contrôle - Remplacer 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); 
     } 
    }, 

Répondre

3

Je l'ai résolu en mettant le code juste au-dessus

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

J'ai essayé de faire cela, mais il ne semble pas avoir d'effet. Y at-il autre chose que je dois faire en plus d'ajouter ce code à ma page aspx? – merk

Questions connexes