or
Private Sub CustomerGridView_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CustomerGridView.ValueChanged
If CustomerGridView.CurrentRow IsNot Nothing AndAlso
Me.CustomerGridView.Columns(COL_customerType).IsCurrent Then
Dim editor = TryCast(sender, RadDropDownListEditor)
If editor IsNot Nothing Then
Dim editorElement = TryCast(editor.EditorElement, RadDropDownListEditorElement)
If editorElement IsNot Nothing Then
Dim selectedItem = TryCast(editorElement.SelectedItem.DataBoundItem, CustomerType)
If selectedItem IsNot Nothing The
Dim currentCustomer = TryCast(CustomerGridView.CurrentRow.DataBoundItem, Customer)
Customer.CustomerTypeId = selectedItem.CustomerTypeId
End If
End If
End If
End If
End Sub
private void grid_CellEndEdit(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if (grid.CurrentCell.ColumnIndex == 5)
{
grid.CurrentRow.Cells[6].Value = maksharga * (int)grid.CurrentRow.Cells[5].Value;
}
}
In order to get the customer type name to show up (instead of the customer type id) we need to bind the combobox to the full set of customer types. But when the user adds a new one, they cannot have the System Customer as an option in the list.
I am filtering out the items that we don't want and rebinding it. But the new list is ignored and the full list is populated.
Any tips?
My code is below:
Private Sub CustomerGridView_CellBeginEdit(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCellCancelEventArgs) Handles CustomerGridView.CellBeginEdit
' The list of types available for selection is different from the list that is
' bound for display, so handle this here.
Dim DropDownListEditor As RadDropDownListEditor = TryCast(Me.CustomerGridView.ActiveEditor, RadDropDownListEditor)
If DropDownListEditor IsNot Nothing Then
If (CustomerGridView.Columns(e.ColumnIndex).Name = "Type") Then
Dim editorElement As RadDropDownListEditorElement = CType(DropDownListEditor.EditorElement, RadDropDownListEditorElement)
Dim filteredList = OriginalList.
Where(Function(d) d.IsSystem = false)
editorElement.DataSource = filteredList.ToList
End If
End If
End Sub