PDA

View Full Version : [CLOSED] Why direct methods are not working? Ext.net v2.5



Ariel
Jul 14, 2015, 4:32 PM
We have a User Control that has a "Save" button. When pressing the button the system should ask the user for a name and then call a Direct Method to actually perform the saving.

The code below doesn't work and I need your help. After the dialog window, the system doesn't call the DirectMethod:



<ext:Button ID="ButtonSaveSettings" runat="server" Icon="Disk" Text="Save" IconAlign="Top" >
<Listeners>
<Click Handler="Ext.Msg.prompt('Please name your new Screener', 'Screener Name:', function (buttonId, text) { #{DirectMethods}.Screener_Save_Name(buttonId, text); });" />
</Listeners>
</ext:Button>

Ariel
Jul 14, 2015, 4:57 PM
To those users who encounter this problem often - Make sure that your handler sends the correct parameters and types.

Here is the code that works:

User Control Code:


<ext:Button ID="ButtonSaveSettings" runat="server" Icon="Disk" Text="Save" IconAlign="Top" >
<Listeners>
<Click Handler="Ext.Msg.prompt( 'Please name your new Screener', 'Screener Name:',
{ apply: function(obj,args)
{
if (args[0]=='ok') {
#{DirectMethods}.Screener_Save_Name(args[1]);
}
}});" />
</Listeners>
</ext:Button>




CODE BEHIND:


[DirectMethod]
public void Screener_Save_Name(string ScreenerName)
{
....
}