Home Forums WinForms controls Xceed Grid for WinForms Problem to create insertion row with buttom

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14951 |

    Hi,

    I add to my rows custom button, at it work fine, with that code foreach row:

    dr1.BeginEdit();

    Button btnBrowse = new Button();
    btnBrowse.Click +=new EventHandler(btnBrowse_Click);

    CellEditorManager btnEditor = new CellEditorManager(btnBrowse,
    “Text”, true, true);
    CellViewerManager btnViewer = new CellViewerManager(btnBrowse, “Text”);

    dr1.Cells[“Browse”].CellEditorManager = btnEditor;
    dr1.Cells[“Browse”].CellViewerManager = btnViewer;
    dr1.Cells[“Browse”].Value = “…”;

    dr1.EndEdit();

    but when i try to add in the same way button to the insertion row like this:
    insertionRow1.BeginEdit();

    Button btnBrowse = new Button();
    btnBrowse.Click +=new EventHandler(btnBrowse_Click);

    CellEditorManager btnEditor = new CellEditorManager(btnBrowse,
    “Text”, true, true);
    CellViewerManager btnViewer = new CellViewerManager(btnBrowse, “Text”);

    insertionRow1.Cells[“Browse”].CellEditorManager = btnEditor;
    insertionRow1.Cells[“Browse”].CellViewerManager = btnViewer;
    insertionRow1.Cells[“Browse”].Value = “…”;

    insertionRow1.EndEdit();

    its make the button ok(though doesn’t have any text in it -???) but it also add another empty row at the begining in addition to the insertion row, why?
    and who can i make it right?

    Thanks

    Amihai

    Imported from legacy forums. Posted by ami_an (had 2859 views)

    User (Old forums)
    Member
    Post count: 23064

    Calling insertionRow1.EndEdit() adds the row to the DataRow collection, which therefore is not an insertion row any longer.

    Imported from legacy forums. Posted by André (had 187 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you,

    But i didn’t understand what should i do?
    I try to remove the insertionRow1.EndEdit() but the problem still stay.
    how can i add the button to the insertion row without that problem?

    Thanks
    Amihai

    Imported from legacy forums. Posted by ami_an (had 298 views)

    User (Old forums)
    Member
    Post count: 23064

    Normally, you set up the CellEditorManager and the CellViewerManager on the Column, not on the cells themselves. This will ensure every cell of that column will have an editor, including the InsertionRow cell.

    e.g. :

    gridControl1.Columns[ “Browse” ].CellEditorManager = new CellEditorManager( btnBrowse, “Text”, true, true );
    gridControl1.Columns[ “Browse” ].CellViewerManager = new CellViewerManager( btnBrowse, “Text” );

    You do this at form_load, before loading the grid with data, since it is a template, and it must be set up before the grid is filled, so it is taken into account when actually building the cells.

    Imported from legacy forums. Posted by André (had 3885 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.