评级控件将不会引发事件,如果用户点击的额定电流星级监守行为的js已检查 如果(this._ratingValue!= this._currentRating),所以我想在不改变js和建设的无线工具包重写此方法。我怎么能做到这一点,我可以延长等级控制和超越控制RatingBehavior.js或任何其他解决方案。
_onStarClick:功能(E){
///<总结>
///处理器为一颗星的单击事件
///< /总结>
///< PARAM NAME =E型=Sys.UI.DomEvent>
///事件信息
///< /参数>
如果(this._readOnly){
返回;
}
如果(this._ratingValue!= this._currentRating){
this.set_Rating(this._currentRating);
}
},
解决方案
我已经通过将code略高于
解决了它
函数AddNewRatingHandler(){
AjaxControlToolkit.RatingBehavior.prototype._onStarClick =
功能(E){
如果(this._readOnly){
返回;
}
//如果(this._ratingValue!= this._currentRating){
this.set_Rating(this._currentRating);
//}
};
AjaxControlToolkit.RatingBehavior.prototype.set_Rating =函数(值){
//如果(this._ratingValue!=值){
this._ratingValue =价值;
this._currentRating =价值;
如果(this.get_isInitialized()){
如果((值小于0)||(值GT; this._maxRatingValue)){
返回;
}
this._update();
AjaxControlToolkit.RatingBehavior.callBaseMethod(这一点,set_ClientState',[this._ratingValue]);
this.raisePropertyChanged('评级');
this.raiseRated(this._currentRating);
this._waitingMode(真正的);
变参= this._currentRating +; + this._tag;
VAR ID = this._callbackID;
如果(this._autoPostBack){
__doPostBack(ID,参数);
}
其他 {
WebForm_DoCallback(ID,指定参数时,this._receiveServerData,这一点,this._onError,真)
}
}
//}
};
}
AddNewRatingHandler();
< / SCRIPT>
< / DIV>
< /形式GT;
Rating control in ajax control toolkit will not raise event if user clicks on current rating star becuase in behaviour js it has checking if (this._ratingValue != this._currentRating) , so i want to override this method without changing js and building tookit. How can i do it , can i extend rating control and overide RatingBehavior.js or any other solution.
_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);
}
},
解决方案
I have solved it by putting the code just above
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>