I have a DataBoundGrid control that is bound to a DataView. The dataview is using a filter to only show rows that match on a certain foreign key. I was to allow the user to add new rows to the grid and automatically populate that column with the value that is being used to filter the view. I have tried placing the code to set the value in a number of different events but have not had any luck. This is a hidden column as they user has no need to know anything about it.
What is the best way of going about this? Which event should I be using.
ADAdministrator Syncfusion Team December 24, 2002 12:20 PM
Do you want to do this work when the user types in the new row at the bottom of the grid?
If so, you can try catching the RowEditing event and test to see if you are on that last row.
Private Sub GridDataBoundGrid1_RowEditing(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridRowEventArgs) Handles GridDataBoundGrid1.RowEditing
Dim cm As CurrencyManager
cm = CType(Me.BindingContext(Me.GridDataBoundGrid1.DataSource, Me.GridDataBoundGrid1.DataMember), CurrencyManager)
Dim editRowIndex = Me.GridDataBoundGrid1.CurrentCell.RowIndex
If (editRowIndex > cm.Count) Then
Console.WriteLine("new row GridDataBoundGrid1_RowEditing")