MVC5中按钮(Devexpress控件)的客户端事件

时间:2017-02-15 10:38:00

标签: razor asp.net-mvc-5 devexpress

如何使用Razor在MVC5中实现按钮(Devexpress控件)的客户端事件。

我尝试了这个,但点击事件没有解雇

<script type="text/javascript">
function OnClick(sender, args)
{
    alert("Click");
}
</script>
@Html.DevExpress().Button(settings =>
{
    settings.Name = "Button";
    settings.Text = "Submit";
    settings.ClientSideEvents.Click = "function(sender,args){ alert('Click'); }";
}).GetHtml()

1 个答案:

答案 0 :(得分:0)

您需要设置Message Enqueued 并替换settings.EnableClientSideAPI = true;settings.ClientSideEvents.Click = "function(sender,args){ alert('Click'); }";