gpt4 book ai didi

asp.net - Ajax 控件工具包 Rating Control- Override RatingBehavior.js

转载 作者:行者123 更新时间:2023-11-29 20:26:17 24 4
gpt4 key购买 nike

如果用户点击当前评级星,Ajax 控件工具包中的评级控件将不会引发事件,因为在行为 js 中它已检查if (this._ratingValue != this._currentRating),所以我想在不改变js和构建工具包的情况下覆盖这个方法。我该怎么做,我可以扩展评级控制并覆盖 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);
}
},

最佳答案

我把代码放在上面解决了

    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>

关于asp.net - Ajax 控件工具包 Rating Control- Override RatingBehavior.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/531072/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com