Home Forums WinForms controls Xceed Grid for WinForms Adding Colums + Rows Programatically

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

    HI all,

    I have a DataTable object which is filled with data, If I directly assign it to data source of the Xceed datagrid, that will take default Column names and same time display Unwanted Columns too..

     So, I need to populate the grid with some selected Columns out of the DataTable which I have, and same time with customized Column name.

    I searched in whole KB but couldn’t find any good article relating to this.

     – Regards

    Buddhi from Sri Lanka

    Imported from legacy forums. Posted by bdmsoft (had 2019 views)

    User (Old forums)
    Member
    Post count: 23064

    Set the AutoCreateColumns property on GridControl to false, and provide only the columns you want through the DataBoundColumn class (they have to have the same FieldName and DataType as the one in the DataTable), and set the Title property to the name you want to display.

     

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

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    I tried my best, but I no success…  Could you please give me a small sample code. At least very basic one.

     

    Imported from legacy forums. Posted by bdmsoft (had 231 views)

    User (Old forums)
    Member
    Post count: 23064

    I have attached a sample application demonstrating this.  It should work as is if you are on Vista and using the latest version of the gird.  If not, the you can still use the code and reproduce it in your own application.

    The DataSet has 11 columns, but I display only 4 of them, and I change the name they display in columns header.

     

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

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