PanelManager.DisplayControl without Right click menu

this code can show data in grid,but without Right click menu like this:

    public static void DisplayInGrid(this DataTable dataTable, string title = null)

    {

        if (string.IsNullOrEmpty(title)) title = "&Custom";

        var dgrid = new DataGridView { DataSource = dataTable };

        PanelManager.DisplayControl(dgrid, title);

    }

Comments

  • What's your question?

  • @JoeAlbahari said:
    What's your question?

    i use this code to display list to grid. but i cant do exort to excel
    ```
    public static void DisplayInGrid(this DataTable dataTable, string title = null)

    {
    
        if (string.IsNullOrEmpty(title)) title = "&Custom";
    
        var dgrid = new DataGridView { DataSource = dataTable };
    
        PanelManager.DisplayControl(dgrid, title);
    
    }
    

    ```

  • That's right. You will see those export options only if you use LINQPad's grid by dumping the dataTable directly:

    dataTable.Dump (true);
    

    LINQPad's grid is a heavily customized version of DataGridView. By instantiating a DataGridView explicitly, you're using the standard DataGridView which doesn't have the features you see in LINQPad's context menu.