Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1440
Usercontrol In UltraWinGrid Questions
posted

Hello

I have a ultradropdownbutton user control that pops a ultrapanel containing 2 buttons --- (OK and Cancel).  This user control is in a separate DLL and is embedded into a ultrawingrid cell.  Here are my questions covering a variety of areas.  Please advise on each question with details of how to accomplish.

  1. Can I specify that the cell containing the user control is always in edit mode so I don't have to double click the cell to enter edit mode and then expand the dropdown? 
  2. When I click on the cell containing the usercontrol, the user control is populated correctly ONLY for the first row selected.  After that, no matter what row I click on, the data from the first row is what is passed to the usercontrol.  What am I missing that's preventing the current cells data from being used by the usercontrol?
  3. Since the usercontrol contains 2 buttons, I'm confussed on what I need to do to have the following behavior:
    1. When I Select "Cancel" I just want to close the usercontrol and leave the passed value as it was initially,
    2. When I Select "OK" I want to place the new value into the cells value and then close the usercontrol.
  4. Finally, if the value of the usercontrol cell changes, I want to identify the grid as dirty so I can prompt the user to update if they try to exit without saving the changes

Thanks in advance

Clay Seifert

Parents
  • 469350
    Offline posted

    Hi Clay,

    ClaySeifert said:
    Can I specify that the cell containing the user control is always in edit mode so I don't have to double click the cell to enter edit mode and then expand the dropdown? 

    I assume you are embedding your control in the grid using the UltraControlContainerEditor? If that is the case, then the answer is no, you cannot tell the cell to always be in edit mode. That's not possible, since it would mean using a separate EditingControl for every cell and the UltraControlContainerEditor only allows you to use one control.

    However, you can achieve what you want by setting EnterEditModeMouseBehavior on the UltraControlContainerEditor to EnterEditModeAndClick. This tells the editor to forward the mouse message on to the EditingControl after the cell enters edit mode. So a single click will both enter edit mode and drop it down.

    ClaySeifert said:
    When I click on the cell containing the usercontrol, the user control is populated correctly ONLY for the first row selected.  After that, no matter what row I click on, the data from the first row is what is passed to the usercontrol.  What am I missing that's preventing the current cells data from being used by the usercontrol?

    When a cell enters edit mode, the UltraControlContainerEditor sets the Value of your EditingControl to the Value of the cell. So something must not be set up correctly in your control or the UltraControlContainerEditor. I'm afraid I can't guess what that is, but if you can post a small sample project demonstrating this behavior, I would be happy to take a look.

    Maybe you need to specify the EditingControlPropertyName? Or maybe the control you are using is simply not responding the second time it's value is set?

    ClaySeifert said:
    Since the usercontrol contains 2 buttons, I'm confussed on what I need to do to have the following behavior:
    1. When I Select "Cancel" I just want to close the usercontrol and leave the passed value as it was initially,
    2. When I Select "OK" I want to place the new value into the cells value and then close the usercontrol.

    I'm not sure I understand. What new value are you referring to?

    If the user changes the value in a cell and leaves that cell, the new value will be committed to the cell in the underlying data source. You might be able to change that using the UpdateMode property of the grid, but even then, once the user moves to another row, the BindingManager does an implicit update on the previously active row and there is no way around that.

    I suppose you might be able to do something by returning a different value from your UserControl depending on which button was pressed, but there is just not enough information in your post here to understand what exactly you are trying to do.

    ClaySeifert said:
    Finally, if the value of the usercontrol cell changes, I want to identify the grid as dirty so I can prompt the user to update if they try to exit without saving the changes

    It depends what kind of changes you are trying to track here. The grid only tracks changes in the current cell or row. Once you leave the cell/row (depending on the UpdateMode), the changes are written to the grid's DataSource. Once that happens, the grid is no longer a part of the update process and does not track those changes any more.

    After that, it's up to the DataSource you are using to track changes that need to be written to the back end. A DataSet/DataTable, for example, keeps track of all changes until you call AcceptChanges.

    To ensure that all updates from the grid are written to the data source, you can use the grid's UpdateData method.

     

Reply Children
No Data