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
4165
How to know what grid I am on with a UltraToolbarManager Context Menu
posted

Hi,

I have a tab control with a few tabs and a few grids...I also have a toolbar manager just for a single context menu that all grids share.

1) How can I know what grid I am on when I right click? Maybe just look at the active tab?

2) On a side note, performance wise should I be using 1 grid on the shared tab page InitGrid/InitRows everytime somoene changes a tab or is it better to use sepreate grids.

Thanks,

Mel

 

  • 469350
    Verified Answer
    Offline posted

    Hi Mel,

    melegant said:
    1) How can I know what grid I am on when I right click? Maybe just look at the active tab?

    You should probably use the MouseDown event on the grid to store which control was right-clicked.

    Another option would be to use the Form.ActiveControl - but I'm not sure right-clicking on the grid makes it active.

    melegant said:
    2) On a side note, performance wise should I be using 1 grid on the shared tab page InitGrid/InitRows everytime somoene changes a tab or is it better to use sepreate grids.

    It depends what kind of performance you are concerned with and the needs of your application. If each grid is showing basically the same data structure (same columns and bands), then using a single grid might not be a bad idea. This will save on memory usage, but it means every time the user switches tabs, you have to re-bind the grid to a new data source. This means that you will lose state information, so when the user switches tabs, they will lose the active row, scroll position, and selection on the previous tab.

    Using one grid per tab uses up more memory, but you will not lose any state information and you don't have to rebind the grid every time you change tabs, so your application will probably be more responsive.