Apr 16, 2012, 5:58 PM
[CLOSED] Problem with DirectMethods and Different instances of controls while in Release mode
Hi again!
I'm having troubles when compiling in release mode.
I'll explain the situation first.
I have a user control containing a grid, the user control configures the grid to display different commands on it. One of those commands is the "Delete" command.
Whenever the user presses "Delete" it shows a confirmation window's.The confirm button calls a direct method.
The problem that i'm having is that if i have more than one control in the page, whenever i confirm in any window, the directmethod from the last usercontrol gets called. This only happens in RELEASE mode in DEBUG it works OK.
This is the code that executes the confirmation:
Thanks!
I'm having troubles when compiling in release mode.
I'll explain the situation first.
I have a user control containing a grid, the user control configures the grid to display different commands on it. One of those commands is the "Delete" command.
Whenever the user presses "Delete" it shows a confirmation window's.The confirm button calls a direct method.
The problem that i'm having is that if i have more than one control in the page, whenever i confirm in any window, the directmethod from the last usercontrol gets called. This only happens in RELEASE mode in DEBUG it works OK.
This is the code that executes the confirmation:
if (command == "Delete" && CommandDeleteRequiresConfirmation)
{
result.RequiresConfirmation = true;
result.ConfirmationMessage = "¿Desea eliminar el registro seleccionado?";
result.ConfirmationTitle = "Confirmación de eliminación";
result.ConfirmationSuccessMethodName = this.ClientID + ".Grid" + command + "Command";
Telefe.Framework.Logging.Logger.DebugFormat("{0} - Confirmed {2} will call: {1}", this.ID, result.ConfirmationSuccessMethodName, command);
}
else if (command == "Edit" && CommandEditRequiresConfirmation)
{
result.RequiresConfirmation = true;
result.ConfirmationMessage = "¿Desea editar el registro seleccionado?";
result.ConfirmationTitle = "Confirmación de edicion";
result.ConfirmationSuccessMethodName = this.ClientID + ".Grid" + command + "Command";
Telefe.Framework.Logging.Logger.DebugFormat("{0} - Confirmed {2} will call: {1}", this.ID, result.ConfirmationSuccessMethodName, command);
}
else if (command == "Clone" && CommandCloneRequiresConfirmation)
{
result.RequiresConfirmation = true;
result.ConfirmationMessage = "¿Desea clonar el registro seleccionado?";
result.ConfirmationTitle = "Confirmación de clonacion";
result.ConfirmationSuccessMethodName = this.ClientID + ".Grid" + command + "Command";
Telefe.Framework.Logging.Logger.DebugFormat("{0} - Confirmed {2} will call: {1}", this.ID, result.ConfirmationSuccessMethodName, command);
}
And then i show the confirmation window: if (result.RequiresConfirmation)
{
var method = string.Format("Ext.net.DirectMethods.{0}({1})",result.ConfirmationSuccessMethodName, id);
var messageBoxButtonConfig = new MessageBoxButtonsConfig
{
Yes = new MessageBoxButtonConfig { Handler = method, Text = "Si", },
No = new MessageBoxButtonConfig { Handler = "", Text = "No", }
};
X.Msg.Confirm(result.ConfirmationTitle, result.ConfirmationMessage, messageBoxButtonConfig).Show();
}
And this is the code of the direct method: /// <summary>
/// This command executes when the user confirms a Delete command
/// </summary>
/// <param name="id">The id of the row to delete</param>
[DirectMethod]
public virtual void GridDeleteCommand(long id)
{
Telefe.Framework.Logging.Logger.DebugFormat("{0} - GridDeleteCommand ({1}): {3} - {2} ", this.ID, id, CommandDeleteAction, _commandDeleteActionName);
}
This is the output of the rendered js:ctl00_ContentPlaceHolder1_grdEmisionesCaidas: {
GridCreateCommand: function (id, config) {
Ext.net.DirectMethod.request("GridCreateCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
GridCloneCommand: function (id, config) {
Ext.net.DirectMethod.request("GridCloneCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
GridDeleteCommand: function (id, config) {
Ext.net.DirectMethod.request("GridDeleteCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
GridEditCommand: function (id, config) {
Ext.net.DirectMethod.request("GridEditCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
OnRefresh: function (e, config) {
Ext.net.DirectMethod.request("OnRefresh", Ext.applyIf(config || {}, {
params: {
e: e
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
RaiseWindowClosed: function (config) {
Ext.net.DirectMethod.request("RaiseWindowClosed", Ext.applyIf(config || {}, {
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
}
},
ctl00_ContentPlaceHolder1_grdTotalesPrograma: {
GridCreateCommand: function (id, config) {
Ext.net.DirectMethod.request("GridCreateCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
GridCloneCommand: function (id, config) {
Ext.net.DirectMethod.request("GridCloneCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
GridDeleteCommand: function (id, config) {
Ext.net.DirectMethod.request("GridDeleteCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
GridEditCommand: function (id, config) {
Ext.net.DirectMethod.request("GridEditCommand", Ext.applyIf(config || {}, {
params: {
id: id
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
OnRefresh: function (e, config) {
Ext.net.DirectMethod.request("OnRefresh", Ext.applyIf(config || {}, {
params: {
e: e
},
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
},
RaiseWindowClosed: function (config) {
Ext.net.DirectMethod.request("RaiseWindowClosed", Ext.applyIf(config || {}, {
control: "ctl00_ContentPlaceHolder1_grdTotalesPrograma"
}));
}
}
Is this a bug of the ext.net or what's is causing this different behaviour between the Release mode and the Debug one?Thanks!
Last edited by Daniil; Apr 19, 2012 at 7:37 PM.
Reason: [CLOSED]