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
125
Removing the default row selection in ultragrid
posted

Hi

I have an ultragrid on a form with multiple bands displayed hierarchically.The data being displayed in the grid gets updated on a real time basis from a server.

We need to provide a feature on the grid, where the user can edit a specific column's cell values while the grid gets refreshed on the real time.

The problem here is when the cell in the band 1 of the grid is in editmode, we receive data from the server and the underlying datatable gets changed. And then the first row is selected by default.

This will move the focus out of the cell that the user is amending.

To remove the default row selection i have set the folowing property :

grid.DisplayLayout.Override.SelectTypeRow =

SelectType.None;

I then used the following code in the InitialiseRow and it stopped the default selection.

gridStrategies.ActiveRow = e.Row;

gridStrategies.ActiveRow =

null;

 But it did not solve the problem, When the activerow is being set, the focus is lost from the cell that the user is updating.

The problem is with the default selection of the first row. Can you please help with this?

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    If focus is shifting to the first row in the grid, it's because the current position of the BindingManager is positioning to the first row of data and the grid is simply synchronizing the active row to the same row.

    You can turn this function of the grid off using the SyncWithCurrencyManager property.

    But I don't think that will solve the whole problem. If you are constantly updating the data and thus sending notifications to the grid that the data has change, then the grid will constantly be updating it's cell data and anything the user types in will be overwritten and the grid will constantly be forced out of edit mode.

    I don't think what you are trying to do is possible - it's an inherent contradiction.

    What you probably will have to do is give the user some other way to edit the data - outside of the grid in controls that are not databound.

     

Children