Printable View
Hi...
I use this and work Ok.. SVN 2.1
But it's possible execute the test client side so as not to generate traffic to the server:Code:ExtNet.Msg.Show(new MessageBoxConfig
{
Title = "Avviso",
Message = "Delete this user: " + rowUte.UteUte + " ?",
Width = 300,
Buttons = MessageBox.Button.YESNO,
MessageBoxButtonsConfig = new MessageBoxButtonsConfig
{
Yes = new MessageBoxButtonConfig
{
Text = "Si",
Handler = "Ext.net.DirectMethods.Delete()"
},
No = new MessageBoxButtonConfig
{
Text = "No"
}
},
Icon = MessageBox.Icon.QUESTION
});
[DirectMethod]
public void Delete()
{
}
Client side:
Server sideCode:<ext:Button ID="ButtonDelete" runat="server" Text="Cancella" Disabled="true" Scale="Medium"
IconUrl="Images/Icon/delete24.png" ToolTip="Cancella il cliente selezionato."
ToolTipType="Title">
<Listeners>
<Click Handler="DeleteCliente(#{GridPanelClienti}.getSelectionModel().getLastSelected(),
'Avviso',
'Delete Cliente: ' + #{GridPanelClienti}.getSelectionModel().getLastSelected().get('CliRagSoc') + ' ?')" />
</Listeners>
</ext:Button>
<script type="text/javascript">
var DeleteCliente = function (record, Title, Message) {
if (condition)
{
Ext.Msg.show({
title: Title,
msg: Message,
buttons: { yes: "Si", no: "No" },
icon: Ext.Msg.QUESTION,
fn: function (btn) {
if (btn == 'yes') {
Ext.net.DirectMethods.Delete(record.data.CliId);//send the id to delete
}
}
});
}
};
</script>
ThanksCode:
[DirectMethod]
public void DeleteCliente(int pCliId)
{
}
Aurelio
Hi everybody,
@Aurelio suggest a good thing. Really, if an action can be done client side, it is good to avoid an AJAX request.
If you really need a server action, please provide a full test case (but simplified) to reproduce the problem (an ASPX and an ASCX).
Hello,
Aurelio thanks for the answer, but it still has the same error
Uncaught TypeError: Can not call method 'Doyes' of undefined
in server sideCode:<script type="text/javascript">
var confirmacion = function () {
Ext.Msg.show({
title: "Aviso",
msg: "Desea grabar los datos antes de cerrar la ventana?",
buttons: { yes: "Si", no: "No" },
icon: Ext.Msg.QUESTION,
fn: function (btn) {
if (btn == 'yes') {
Ext.net.DirectMethods.DoYes();
}
}
});
};
</script>
<ext:Window runat="server" ID="WinFindCliente" AutoShow="false" Modal="true" Hidden="true"
Width="700" Height="270" BodyPadding="5" Title="Bloqueo del Cliente">
<Items>
<ext:Panel ID="Panel1" runat="server" BodyStyle="background-color:#F8F8F8; padding:5px; border:dotted 1px gray;"
Title="Datos del Cliente">
</ext:Panel>
<ext:Panel runat="server" BodyPadding="5">
<Items><ext:TextArea ID="txtRazon" runat="server" Width="670" FieldLabel="Razon del Bloqueo" LabelAlign="Top" LabelStyle="font-weight:bold;"/>
<ext:TextField runat="server" Visible="false" ID="txtDocumento"></ext:TextField>
</Items>
<Buttons>
<ext:Button ID="btnGrabar" runat="server" Text="Grabar" Icon="DatabaseSave">
<DirectEvents>
<Click OnEvent="BtnGrabarBloqueoClick"></Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="btnCancelar" runat="server" Text="Cerrar" Icon="Cancel">
<Listeners>
<Click Handler="confirmacion();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Window>
Code:[DirectMethod]
public void DoYes()
{
saveData();
WinFindCliente.Hide();
}
HI... jtorroledo
In tne ResourceManager insert this:
DirectMethodNamespace="Ext.net.DirectMethods"
Code:<ext:ResourceManager ID="ResourceManager1" runat="server" HideInDesign="True" Theme="Gray" DirectMethodNamespace="Ext.net.DirectMethods" />
Sorry I forgot to enter the command DirectMethodNamespace="Ext.net.DirectMethods" in the ResourceManager
It's work ok...
If you have indicate: DirectMethodNamespace="YY" in this case the Javascript here:
It's work ok...Code:<script type="text/javascript">
var confirmacion = function () {
Ext.Msg.show({
title: "Aviso",
msg: "Desea grabar los datos antes de cerrar la ventana?",
buttons: { yes: "Si", no: "No" },
icon: Ext.Msg.QUESTION,
fn: function (btn) {
if (btn == 'yes') {
YY.DoYes();
}
}
});
};
</script>
I use the versione 2.1 of Ext.Net in the directory Branches
Aurelio
Please note that the default DirectMethodNamespace is "App.direct" in Ext.NET v2.
Hi Daniil, Aurelio,
My DirectMethodNamespace not working properly, I used the examples of Aurelio and not working, I have tried with a new project with NutGet ext.net downloading but I've the same error
Attachment 5412.
How I can validate if the installation of ext.net is successful?
Thanks!!
Please note that if DirectMethod inside user control then it will add additional namespace
https://examples2.ext.net/#/Events/D.../UserControls/Code:App.direct.ClientIDOfUserControl.MerthodName
You can set own alias (instead ClientID) or remove that alias via 'DirectMethodProxyID' attribute
See the following sample
https://examples2.ext.net/#/Events/D...thods/ID_Mode/
Thanks!! it works well.