[CLOSED] Delete item GridPanel

  1. #1

    [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]
  2. #2
    google translate:
    você não pode usar Windows Forms aqui. Se você quiser usar as caixas de mensagem no Ext.NET, então use o código abaixo.


    you can't use windows forms here. If you want to use message boxes in Ext.NET, then use the code below.

    X.MessageBox.Show(
                    new MessageBoxConfig { Message = "Are you sure you want to delete this record?", Icon = MessageBox.Icon.QUESTION, Title = "Confirm delete" });
  3. #3
    Please investigate the related thread:
    http://forums.ext.net/showthread.php?13944
  4. #4

    It did not work

    When I'm using:

    "X.MessageBox.Show (MessageBoxConfig new {Message =" Are you sure you want to delete this record? "Icon = MessageBox.Icon.QUESTION, Title =" Confirm delete "});
    this.ExcluirFileWath (); "
    Not shown in dialog. Thus the item is deleted directly.
    Last edited by Daniil; Jun 07, 2011 at 5:02 PM. Reason: Please use [CODE] tags
  5. #5
    Quote Originally Posted by stoque View Post
    When I'm using:

    "X.MessageBox.Show (MessageBoxConfig new {Message =" Are you sure you want to delete this record? "Icon = MessageBox.Icon.QUESTION, Title =" Confirm delete "});
    this.ExcluirFileWath (); "
    Not shown in dialog. Thus the item is deleted directly.
    Sorry, instead of X.MessageBox.Show, use X.MessageBox.Confirm method

    examples here: https://examples1.ext.net/#/MessageBox/Basic/Overview/

Similar Threads

  1. [CLOSED] Move up/down gridpanel , delete gridpanel data can not work
    By gs_user in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 27, 2012, 12:37 AM
  2. [CLOSED] Reload Clild Iframe after delete item.
    By stoque in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Oct 23, 2011, 5:19 PM
  3. [CLOSED] Delete selected Item from PropertyGrid
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 21, 2011, 10:41 PM
  4. [CLOSED] dataview delete item(s)
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 01, 2011, 1:46 PM
  5. Replies: 0
    Last Post: Jul 23, 2010, 6:35 AM

Tags for this Thread

Posting Permissions