Forums

Disabling / enabling Actions

Last post 2/9/2010 6:09 AM by FAIV FEDERAZIONE ARTIGIANI IMPRENDITORI VICENTINI. 5 replies.
Sort Posts: Previous Next
  • FAIV FEDERAZIONE ARTIGIANI IMPRENDITORI VICENTINI

    Disabling / enabling Actions

    2/9/2010 5:07 AM
    • Not Ranked
    • Joined on 12/3/2008
    • Posts 11

    Hello
    I have a problem with disabling / enabling actions.
    I disable all the buttons both in ListViewController and DetailViewController for a specific Business Class.


    ListViewController
    private void LISTA_DA_REGISTRO_ListViewController_ViewControlsCreated( object sender, EventArgs e )
    {
    .......................................
    .......................................
                this.Frame.GetController<DetailViewController>().Active.SetItemValue("Edit", false);
                this.Frame.GetController<NewObjectViewController>().Active.SetItemValue( "NewItem", false );
                this.Frame.GetController<DeleteObjectsViewController>().Active.SetItemValue( "Delete", false );
                
                this.Frame.GetController<RefreshController>().Active.SetItemValue("Refresh", false);
                this.Frame.GetController<RecordsNavigationController>().Active.SetItemValue( "NextPrev", false );

                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Link", false );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Unlink", false );

                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Save", false );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "SaveAndNew", false );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "SaveAndClose", false );
    .......................................
    .......................................
    }


    DetailViewController
    private void LISTA_DA_REGISTRO_DetailViewController_ViewControlsCreated( object sender, EventArgs e )
    {
    .......................................
    .......................................
                this.Frame.GetController<DetailViewController>().Active.SetItemValue("Edit", false);
                this.Frame.GetController<NewObjectViewController>().Active.SetItemValue( "NewItem", false );
                this.Frame.GetController<DeleteObjectsViewController>().Active.SetItemValue( "Delete", false );
                
                this.Frame.GetController<RefreshController>().Active.SetItemValue("Refresh", false);
                this.Frame.GetController<RecordsNavigationController>().Active.SetItemValue( "NextPrev", false );

                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Link", false );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Unlink", false );

                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Save", false );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "SaveAndNew", false );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "SaveAndClose", false );
    .......................................
    .......................................
    }

    I need to do this, because the user have to press only a custom aspx button in the Detail Form.
    It works fine, but after this i'm not able to restore the actions, in any view controller i choose.

    i use the following code to restore the actions

    private void MUD_Anagrafica_DetailViewController_ViewControlsCreated(object sender, EventArgs e)
    {
    .......................................
    .......................................
                this.Frame.GetController<DetailViewController>().Active.SetItemValue("Edit", true);
                this.Frame.GetController<NewObjectViewController>().Active.SetItemValue( "NewItem", true );
                this.Frame.GetController<DeleteObjectsViewController>().Active.SetItemValue( "Delete", true );
                
                this.Frame.GetController<RefreshController>().Active.SetItemValue("Refresh", true);
                this.Frame.GetController<RecordsNavigationController>().Active.SetItemValue( "NextPrev", true );

                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Link", true );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Unlink", true );

                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "Save", true );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "SaveAndNew", true );
                this.Frame.GetController<DetailViewController>().Active.SetItemValue( "SaveAndClose", true );
    .......................................
    .......................................
    }

    all the controllers are derived from ViewController class : I'm using 9.3 version of DevExpress.
    Am i missing something?

    I haven't found a solution in documentation.

     

    thanks for your help

    Maurilio

  • FAIV FEDERAZIONE ARTIGIANI IMPRENDITORI VICENTINI

    Re: Disabling / enabling Actions

    2/9/2010 5:11 AM
    • Not Ranked
    • Joined on 12/3/2008
    • Posts 11

    False alarm, now it seems works fine...

     

     

     

  • Martin Praxmarer [DX-Squad]

    Re: Disabling / enabling Actions

    2/9/2010 5:13 AM
    • Top 50 Contributor
    • Joined on 3/16/2009
    • Tirol, Austria
    • Posts 534

     Hi Maurilio,

    you should override OnDeactivating in your LISTA_DA_REGISTRO Controllers and restore the Actions there!

  • Marcello

    Re: Disabling / enabling Actions

    2/9/2010 5:14 AM
    • Top 75 Contributor
    • Joined on 11/10/2008
    • Posts 274

    Hi,

    you can disable action overriding OnActivate event and enable again the action overriding OnDeactivate event of Controller.

    Marcello

  • Marcello

    Re: Disabling / enabling Actions

    2/9/2010 5:44 AM
    • Top 75 Contributor
    • Joined on 11/10/2008
    • Posts 274

    Hello Noxe,

    simultaneous response! :-D

    Marcello

  • FAIV FEDERAZIONE ARTIGIANI IMPRENDITORI VICENTINI

    Re: Disabling / enabling Actions

    2/9/2010 6:09 AM
    • Not Ranked
    • Joined on 12/3/2008
    • Posts 11

    Thanks to all of you!!  {:-))

More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.