检测DevExpress MVC ColorEdit组件上的颜色变化

时间:2019-06-01 02:56:00

标签: devexpress

使用MVC @ Html.DevExpress()。ColorEdit组件,我找不到检测用户更改颜色的方法。此控件上没有“ ClientSideEvents”。DevExpress帮助中提到了“ ColorChanged”事件,但是在详尽的搜索找不到任何相关内容。贝娄是有效的代码:

@Html.DevExpress().ColorEdit(s => {
    s.Name = "ColorEdit";
    s.Properties.AllowUserInput = true;
    s.ClientEnabled = true;
}).GetHtml()

1 个答案:

答案 0 :(得分:1)

您可以在“属性”中找到“ ColorChanged”事件。还要确保将属性“ EnableClientSideAPI”设置为true。

@Html.DevExpress().ColorEdit(s => {
    s.Name = "ColorEdit";
    s.Properties.AllowUserInput = true;
    s.ClientEnabled = true;
    s.Properties.EnableClientSideAPI = true;
    s.Properties.ClientSideEvents.ColorChanged = "onColorChanged";
}).GetHtml()

Javascript:

function onColorChanged(s, e) {
    alert("color has changed");
}