Ticket T179848
Visible to All Users
Duplicate

PopupDialog

created 10 years ago

Good day,

What I need is this. Let's say I have a listview containing tasks. I am going to implement an action which takes the tasks the user has selected and display them in a dialog and there the user should select an employee that is going to be responsible for all the tasks. I would think that this dialog should contain OK and Cancel buttons that would then either confirm the action or cancel it.

Can you please provide me with an example of how this dialog should be created? Of course I can create a WinForms dialog and use it to do this but somewhere in your documentation or staff comments I have read that you generally do not recommend this so I would like to ask about the best way of doing this and similar things.

Thanks  a lot,
Ægir

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello Ægir,

To accomplish this task perform the following steps:

  1. Implement a non-persistent class (a class decorated with the NonPersistent attribute) with the Employee and Tasks properties.
  2. Create a PopupWindowShowAction and show a DetailView of the non-persistent class in its CustomizePopupWindowParams event handler.
  3. Add selected tasks (View.SelectedObjects) to the Tasks collection of the non-persistent instance displayed in the DetailView.
    4. Handle the PopupWindowShowAction.Execute event and assign the selected Employee from the e.PopupWindowViewCurrentObject property to the selected tasks.

Review the following links for additional information:

Add an Action that Displays a Pop-up Window
How to: Display a List of Non-Persistent Objects

    Show previous comments (10)
    DevExpress Support Team 10 years ago

      Thank you for the clarification.
      This issue is caused by the fact that you are using two ObjectSpaces. Here is a corrected code snippet:

      C#
      void showActionSelectEmployee_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) { List<Task> listOfTasks = new List<Task>(); foreach (Task task in View.SelectedObjects) { listOfTasks.Add(task); } IObjectSpace objectSpace = Application.CreateObjectSpace(); CriteriaOperator criteriaEmployee = CriteriaOperator.Parse("FullName == 'Jane Doe'"); Employee defaultEmployee = (Employee)objectSpace.FindObject(typeof(Employee), criteriaEmployee); SelectEmployee emp = new SelectEmployee(defaultEmployee); emp.ListOfTasks = listOfTasks; e.View = Application.CreateDetailView(objectSpace, emp); selectEmployeeView = e.View; e.DialogController.SaveOnAccept = false; }
      TI TI
      Tjodskra Islands 10 years ago

        Aaah! - Silly of me not to see that - Problem solved :)
        Thanks a lot,
        Ægir

        DevExpress Support Team 10 years ago

          You're always welcome.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.