Jun 07, 2011, 1:20 PM
[CLOSED] Delete item GridPanel
I have a GridPanel that has buttons to delete and edit. When I click the delete button it goes straight, I would put a message before deleting it.
<ext:CommandColumn Width="60">
<Commands>
<ext:GridCommand Icon="Delete" CommandName="Delete">
<ToolTip Text="Delete" />
</ext:GridCommand>
<ext:CommandSeparator />
<ext:GridCommand Icon="NoteEdit" CommandName="Edit">
<ToolTip Text="Edit" />
</ext:GridCommand>
</Commands>
</ext:CommandColumn>
In the code tried to use MessagerBox, but he passes the message and not the display. /*Carregar os dados do grid nos campos*/
protected void GridPanelButton_Click(object sender, DirectEventArgs e)
{
objFileWatch = JSON.Deserialize<filewatch>(e.ExtraParams["fileWatch"]);
string comando = e.ExtraParams["comando"];
editar = false;
if (objFileWatch != null)
{
if (comando == "Delete")
{
System.Windows.Forms.DialogResult myResult;
myResult = System.Windows.Forms.MessageBox.Show("Are you really delete the item?", "Delete Confirmation", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question);
if (myResult == System.Windows.Forms.DialogResult.OK)
{
this.ExcluirFileWath();
}
else
{
//No delete
}
}
else if (comando == "Edit")
{
this.EditarFileWath();
}
}
}
/*Botão Excluir do Grid*/
private void ExcluirFileWath()
{
try
{
using (ServicoECMClient proxy = new ServicoECMClient())
{
if (proxy.ApagarFileWatch(objFileWatch.id))
{
this.PreencherListaFileWatch();
this.Mensagem("Stoque ECM", "FileWatch excluído com sucesso!", MessageBox.Icon.INFO);
}
else
{
this.Mensagem("Stoque ECM", "Erro ao excluir filewatch!", MessageBox.Icon.ERROR);
}
}
PreencherListaFileWatch();
}
catch { }
}
/*Botão Editar do Grid*/
private void EditarFileWath()
{
editar = true;
ServicoECMClient proxy = new ServicoECMClient();
TextFieldDiretorio.Text = objFileWatch.diretorio;
ComboBoxTipoDocumento.Value = objFileWatch.id_tipodocumento;
TextFieldFiltro.Text = objFileWatch.filtro;
filewatchid = objFileWatch.id;
proxy.Close();
}
Last edited by Daniil; Jun 13, 2011 at 3:52 PM.
Reason: [CLOSED]