We are using the RadGridView for a Silverlight project (vb). We are populating the grid through RIA services with the Microsoft entity data model. The grid is bound fine – the issue we’re having is after a row is inserted we can’t find out how to refresh/rebind the grid to display that new row. We can confirm that the newly inserted row is properly being added to the table with initial column values. However, nothing we have tried has allowed us to rebind the grid automatically after the insert to display that new row. We bind with the following:
Dim
objTimesheets =
Me
.mycontext.Load(mycontext.GetRCTimesheetsQuery)
RadGridView1.ItemsSource = objTimesheets.Entities
We have tried calling this after the insert function (put this is in a LoadGrid sub). Also have tried calling RadGridView1.Rebind()
The following is how we set up the insert:
Private
Sub
RadGridView1_AddingNewDataItem(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs)
Handles
RadGridView1.AddingNewDataItem
e.NewObject =
New
Web.RCTimesheet
End
Sub
Private
Sub
RadGridView1_RowEditEnded(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Windows.Controls.GridViewRowEditEndedEventArgs)
Handles
RadGridView1.RowEditEnded
If
e.EditAction = Telerik.Windows.Controls.GridView.GridViewEditAction.Cancel
Then
Return
End
If
If
e.EditOperationType = Telerik.Windows.Controls.GridView.GridViewEditOperationType.Edit
Then
mycontext.SubmitChanges()
End
If
If
e.EditOperationType = Telerik.Windows.Controls.GridView.GridViewEditOperationType.Insert
Then
Dim
timesheetRow
As
New
Web.RCTimesheet
timesheetRow = e.NewData
timesheetRow.RCEmployeeID = RCEmployeeID
timesheetRow.RCPayPeriodID = RCPayperiodID
timesheetRow.RCTimesheetTaskID = 0
mycontext.RCTimesheets.Add(timesheetRow)
mycontext.SubmitChanges()
End
If
End
Sub
This issue happens with using the insert key on the keyboard, and a button set up that calls the BeginInsert() method. Always the same result – the row is added without flaw to the data table, but we can’t get the client side control to reflect this change.
Also, hitting refresh on the browser (the only way we’ve been able to see newly inserted rows) seems to bug out a foreign key column binding we have set up. The values for all rows except the first will be blank until clicked on (where they will snap to the correct dropdown value).