Home Forums WinForms controls Xceed Grid for WinForms Binding to NHibernate Entities

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

    I’m trying to do some extremely simple data binding, but I can’t find an easy way to do it.

    I have a grid, and I want to bind a list of NHibernate objects to the grid.  Is there a simple way to add a handful of columns and specify what property they should bind to?

    I’ve found I can add a bunch of columns through the designer, but then I have to manually create each row and manually assign each cell its value.

    I then found that I could create BoundColumn objects, assign a few properties, then add them to the grid and bind my list that way.

    The problem here is that my entity has 15 or 20 columns, and I only want to display 6.  I want to use databinding, and I want to configure it through the designer.  Is this possible?

    Imported from legacy forums. Posted by Dan (had 1580 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Dan,

    Unfortunately, you cannot specify only 6 columns out of 20 to be displayed in design time using the Xceed Grid for .NET component. The control does not support this feature.

    Imported from legacy forums. Posted by Mohamed [Xceed] (had 1189 views)

    User (Old forums)
    Member
    Post count: 23064

    Alright.

    I’ve gone the route of programatically creating DataBoundColumn objects.  Something like this:

    		PaymentsGrid.AutoCreateColumns = False
    With PaymentsGrid.Columns
    .Clear()
    .Add(New DataBoundColumn("EffDate") With {.Fixed = True, .Title = "Eff", .FormatSpecifier = "d"})
    .Add(New DataBoundColumn("Payment") With {.Title = "Payment $"})
    .Add(New DataBoundColumn("InvoiceDate") With {.Title = "Invoice", .FormatSpecifier = "d"})
    .Add(New DataBoundColumn("Description") With {.Title = "Description"})
    End With

    But unless I bind data to the grid, none of the columns are displayed.

    How can I show the columns in the empty grid?

    Imported from legacy forums. Posted by Dan (had 1744 views)

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