Home Forums WPF controls Xceed DataGrid for WPF Insert a new row using LINQ

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

    You have many topics in this forums about inserting row with LinqToSQL.  I fallowed all your instructions, I’m using VB and her’s the code:

    Private db As New LinqSQLDataContext

    Private Sub Page1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded

    Dim b As New Binding

    Dim c As New DataGridCollectionView(db.Table1.GetNewBindingList)

    b.Source = c

    Me.DataGridControl1.SetBinding(DataGridControl.ItemsSourceProperty, b)

    End Sub

    I can insert a row and the PK_Id show automaticly 0.  But it stop there, I can not edit the others fields of the inserted row.  All the others rows works fine, I can edit and SubmitChange, sort and filter, but not insert a row.  Can you help me !

    Imported from legacy forums. Posted by Etienne (had 909 views)

    Xceed Support
    Member
    Post count: 5658

    Have you set the AutoCreateColumns property to false? If so, cell editors need to be explicitly provided for each column in order to support insertion (see Column.CellEditor property).

    Imported from legacy forums. Posted by Jenny [Xceed] (had 2580 views)

    User (Old forums)
    Member
    Post count: 23064

    Yes, AutoCreatColumns = False, if I set it to True, it works fine.  I will take a look at the Column.CellEditor.  Can I hide and rename columns in AutoCreatColumns = True mode direcly in my VB code when Page1.Loaded ?

    Imported from legacy forums. Posted by Etienne (had 518 views)

    Xceed Support
    Member
    Post count: 5658

    Yes, you can hide columns by setting their Visible property even if AutoCreateColumns is set to true; however, what I suggest you do if you don’t need to extra columns is to explicit define only the DataGridItemProperty objects you want in your DataGridCollectionView. The defined item properties correspond to the columns that will be in your grid.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 458 views)

    User (Old forums)
    Member
    Post count: 23064

    Tanks for your help

    Imported from legacy forums. Posted by Etienne (had 1677 views)

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