Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#确认CodeBehind中的消息处理程序_C#_Ext.net - Fatal编程技术网

C#确认CodeBehind中的消息处理程序

C#确认CodeBehind中的消息处理程序,c#,ext.net,C#,Ext.net,当我点击一个按钮时,我需要打开一个对话框,这样我就完成了以下工作: 标记: <ext:Button runat="server" ID="Button1" Text="Save New Information" OnDirectClick="Button1_DirectClick"/> 消息框显示正确,但未调用DoYes函数,出现错误: 未捕获的TypeError:无法读取未定义的属性“DoYes” 您需要使用App.direct.DoYes而不是App.direct.DoYes

当我点击一个按钮时,我需要打开一个对话框,这样我就完成了以下工作:

标记:

<ext:Button runat="server" ID="Button1" Text="Save New Information" OnDirectClick="Button1_DirectClick"/>
消息框显示正确,但未调用DoYes函数,出现错误:

未捕获的TypeError:无法读取未定义的属性“DoYes”


您需要使用App.direct.DoYes而不是App.direct.DoYes

<%@ Page Language="C#" %>

<script runat="server">
    protected void Button1_DirectClick(object sender, DirectEventArgs e)
    {
        X.Msg.Confirm("Confirm", "Do you want to update this information also?", new MessageBoxButtonsConfig
        {
            Yes = new MessageBoxButtonConfig
            {
                Handler = "App.direct.DoYes()",
                Text = "Yes"
            },
            No = new MessageBoxButtonConfig
            {
                Handler = "WndwEdit.close()",
                Text = "No"
            }
        }).Show();
    }

    [DirectMethod]
    public void DoYes()
    {
        X.MessageBox.Info("Error NOT", "Something went lalala", AnchorPoint.LeftTop, UI.Danger).Show();
    }
</script>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Ext.NET Example</title>

    <link type="text/css" rel="stylesheet" href="http://speed.ext.net/www/intro/css/main.css" />
</head>
<body>
    <ext:ResourceManager runat="server" Theme="Triton" />

    <ext:Button runat="server" ID="Button1" Text="Save New Information" OnDirectClick="Button1_DirectClick"/>
</body>
</html>

受保护的无效按钮1\u直接单击(对象发送方,DirectEventArgs e)
{
X.Msg.Confirm(“确认”,“是否也要更新此信息?”,new MessageBoxButtonsConfig
{
是=新建MessageBox按钮图
{
Handler=“App.direct.DoYes()”,
Text=“是”
},
否=新建MessageBoxButtonConfig
{
Handler=“WndwEdit.close()”,
Text=“否”
}
}).Show();
}
[直接法]
公共无效DoYes()
{
X.MessageBox.Info(“没有错误”,“有东西出了问题”,AnchorPoint.LeftTop,UI.Danger).Show();
}
Ext.NET示例

请在代码段中包含命名空间和类定义。@ChrisPickford ok done从未使用过ext.net我不熟悉它们的
DirectMethod
拓扑结构,但是您的错误表明
DoYes()
方法未在
App.Direct
命名空间上定义。尝试使用
[DirectMethod(Namespace=“???”]”]
。我尝试使用特定的命名空间,但在使用App.direct.DoYes时均无效。我收到此错误:未捕获类型错误:App.direct.DoYes不是函数尝试将[DirectMethod]更改为[DirectMethod(Namespace=“App.direct”)]此外,请检查web.config中此值的值:directMethodNamespace更多信息,请参见:
<%@ Page Language="C#" %>

<script runat="server">
    protected void Button1_DirectClick(object sender, DirectEventArgs e)
    {
        X.Msg.Confirm("Confirm", "Do you want to update this information also?", new MessageBoxButtonsConfig
        {
            Yes = new MessageBoxButtonConfig
            {
                Handler = "App.direct.DoYes()",
                Text = "Yes"
            },
            No = new MessageBoxButtonConfig
            {
                Handler = "WndwEdit.close()",
                Text = "No"
            }
        }).Show();
    }

    [DirectMethod]
    public void DoYes()
    {
        X.MessageBox.Info("Error NOT", "Something went lalala", AnchorPoint.LeftTop, UI.Danger).Show();
    }
</script>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Ext.NET Example</title>

    <link type="text/css" rel="stylesheet" href="http://speed.ext.net/www/intro/css/main.css" />
</head>
<body>
    <ext:ResourceManager runat="server" Theme="Triton" />

    <ext:Button runat="server" ID="Button1" Text="Save New Information" OnDirectClick="Button1_DirectClick"/>
</body>
</html>