Skip to Content

Agregar columna checkbox en Grid C#

Buenas tardes,

Estoy tratando de realizar un AddOn dentro y quería saber si es que alguien me podría ayudar a agregar una columna de checkbox en un grid simple.

He tratado de buscar ayuda en la documentación del SDK pero no he podido.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Aug 02, 2020 at 11:46 AM

    Hi,

    Here is an example:

    The grid is being filled with a query result and one of the Grid column is being set to Checkbox type:

    string Sql = "Select SelectRow as 'Select', ItemCode as 'Item Code', ItemName as 'Item Name', Qty as 'Qty.', DocRef , LineID , ProjectDescription as 'Project Details', Project From [@TEMPTABLEFORMATERIALREQUEST] Where UserLogin = '" + SBO_Company.UserName + "'";
    
    
    this.m_SBO_Form.DataSources.DataTables.Add("MYDATATABLE");
    this.m_SBO_Form.DataSources.DataTables.Item(0).Clear();
    this.m_SBO_Form.DataSources.DataTables.Item(0).ExecuteQuery(Sql);
    SAPbouiCOM.Grid oGrid = (Grid)this.m_SBO_Form.Items.Item(enControlName.Grid).Specific;
    oGrid.DataTable = this.m_SBO_Form.DataSources.DataTables.Item("MYDATATABLE");
    SAPbouiCOM.EditTextColumn oEditColumn;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("DocRef")));
    oEditColumn.Visible = false;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("LineID")));
    oEditColumn.Visible = false;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Select")));
    oEditColumn.Type = BoGridColumnType.gct_CheckBox;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Item Code")));
    oEditColumn.Editable = false;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Item Name")));
    oEditColumn.Editable = false;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Qty.")));
    oEditColumn.Editable = false;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Project Details")));
    oEditColumn.Editable = false;
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Project")));
    oEditColumn.Visible = false;
    oGrid.AutoResizeColumns();
    oEditColumn = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Item Code")));
    oEditColumn.LinkedObjectType = "4";

    Hope it helps!

    Kind regards,

    ANKIT CHAUHAN

    SAP Business One Support

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.