PDA

View Full Version : [CLOSED] DirectMethod Not Working



imaa
Oct 19, 2013, 8:15 AM
Dear,
We are working on Ext.net V2.3

Direct Method give me Undefined in JS and this is my code:
ASP


<ext:Button Text="بحث" runat="server" ColSpan="2" Icon="Find" Scale="Large" StyleSpec="padding-left: 200px">
<Listeners>
<Click Fn="SerchMember"></Click>
</Listeners>
</ext:Button>

JS


Ext.direct.SerchMember({
success: function (resul)
{ }
});

C#


[DirectMethod]
public void SerchMember()
{
if (1==1)
{

}

}


and I tried Same your sample in
http://examples2.ext.net/#/Events/DirectMethods/Overview/

but it give me App Undefined

geoffrey.mcgill
Oct 20, 2013, 6:00 AM
Hello,

Just change Ext.direct.SearchMember to App.direct.SearchMember.

Example


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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
[DirectMethod]
public void SerchMember()
{
X.Msg.Notify("Message", "Test").Show();
}
</script>

<!DOCTYPE html>

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

<script type="text/javascript">
var SerchMember = function () {
App.direct.SerchMember({
success: function (result) { alert('Success'); }
});
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button Text="Submit" runat="server">
<Listeners>
<Click Fn="SerchMember" />
</Listeners>
</ext:Button>
</form>
</body>
</html>

Hope this helps.