我正在尝试使用以下代码将字符串值传递给Direct Method。
<html>
<head runat="server">
<script runat="server">
protected void btnSubmit_DirectClick(object sender, Ext.Net.DirectEventArgs e)
{
string Name = "Lewis Bland";
string Address = "Las Angels";
X.Msg.Confirm("Confirmation", "Do you want to submit the Details", new MessageBoxButtonsConfig
{
Yes = new MessageBoxButtonConfig
{
Handler = "#{DirectMethods}.fnSaveNameAndAdress(" + Name + "," + Address + ")",
Text = "Yes"
},
No = new MessageBoxButtonConfig
{
Text = "No"
}
}).Show();
}
[DirectMethod(Namespace = "TestAlias")]
public void fnSaveNameAndAdress(string Name, string Address)
{
X.Msg.Alert("Conformed", "Name and Address Submitted Successfully").Show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" ID="resource" SourceFormatting="true" />
<ext:Button ID="btnSubmit" runat="server" Text="Submit" OnDirectClick="btnSubmit_DirectClick" />
</form>
</body>
</html>
上面的代码工作正常,没有任何参数但我通过时 字符串参数它没有触发Method。解雇这种方法我 通过添加以下内容阅读帖子,使用了“别名”概念 线
[DirectMethod(Namespace = "TestAlias")]
并且在CodeBehind中我添加了上面的以下行 类。
[DirectMethodProxyID(IDMode = DirectMethodProxyIDMode.Alias, Alias = "TestAlias")]
即使我添加了这些,它也会触发任何事件。如何克服 这种情况。
谢谢。
答案 0 :(得分:0)
Yes = new MessageBoxButtonConfig
{
Handler = "#{DirectMethods}.fnSaveNameAndAdress(" + Name + "," + Address + ")",
Text = "Yes"
你的代码处理程序中的应该是这样的,我想,
Handler = "TestAlias.fnSaveNameAndAdress(" + Name + "," + Address + ")",