C1TrueDbGrid SetDataBinding (holding fields) does not work

Posted by: oquesada on 11 July 2018, 7:44 pm EST

    • Post Options:
    • Link

    Posted 11 July 2018, 7:44 pm EST

    I have a C1TrueDbgrid v4 instance in a .NET form (C#). In design I created two columns with the following caption: ID and Name.

    The first column is invisible and the second one is visible.

    Then in the Form1_Load event I have the following code:

            dt = new DataTable();
            dt.Columns.Add();
            dt.Columns.Add();
    
            dt.Rows.Add(new object[] { "1","John Smith"});
            dt.Rows.Add(new object[] { "2", "Jane Smith" });
            dt.Rows.Add(new object[] { "3", "Mike B." });
            dt.Rows.Add(new object[] { "3", "Jenna Z." });
            c1TrueDBGrid1.DataSource = null;
            c1TrueDBGrid1.SetDataBinding(dt, "", true);
    

    When I run the application, the grid shows 4 empty records under the “Name” column. No data is displayed.

    If I set the third parameter to false in SetDataBinding method, the data is displayed but layout is not preserved.

    I read your tutorials and created this sample code but the result is not the expected.

    Is there something else I need to do?

  • Posted 12 July 2018, 6:01 am EST

    Hi

    Here, you need to set DataField property of column(s). I am attaching the sample application for your reference.

    Prj_PreserveLayout.zip

    Best regards,

    Meenakshi

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels