Hi I am working on Radgridview where on a particular column I have hidden few options like below.
Private Sub grd_ContextMenuOpening(sender As Object, e As ContextMenuOpeningEventArgs) Handles grd.ContextMenuOpening Dim i As Integer = 0 Dim IgnoreOperator() As String = {"Ends with", "Equals", "not equal to", "no filter"} If DirectCast(e.ContextMenuProvider, Telerik.WinControls.UI.GridCellElement).ColumnInfo.FieldName = "AcctNbr" Then While i < e.ContextMenu.Items.Count If Not IgnoreOperator.Contains(e.ContextMenu.Items(i).Text, StringComparer.CurrentCultureIgnoreCase) Then e.ContextMenu.Items(i).Visibility = Telerik.WinControls.ElementVisibility.Collapsed End If i = i + 1 End While End If End Sub
My requirement is to search data from a different a column of Dataview which is binded to the grid however column header is different.
I wrote below code expecting that when `AcctNbr` is the header of column it will search the dataview(dv) based on the row filter and bind it the grid on UI but it's not working
Private Sub grd_FilterChanging(sender As Object, e As GridViewCollectionChangingEventArgs) Handles grd.FilterChanging
dv.RowFilter =""
If e.NewValue IsNot Nothing
If DirectCast((DirectCast(e.NewItems, Object())(0)), Telerik.WinControls.Data.FilterDescriptor).[Operator] = Telerik.WinControls.Data.FilterOperator.IsEqualTo AndAlso DirectCast((DirectCast(e.NewItems, Object())(0)), Telerik.WinControls.Data.FilterDescriptor).PropertyName = "AcctNbr" Then
Dim CurrentVal As String = CStr(e.NewValue)
dv.RowFilter = "EnAcctNbr ='" & CurrentVal & "'"
End If
If DirectCast((DirectCast(e.NewItems, Object())(0)), Telerik.WinControls.Data.FilterDescriptor).[Operator] = Telerik.WinControls.Data.FilterOperator.IsNotEqualTo AndAlso DirectCast((DirectCast(e.NewItems, Object())(0)), Telerik.WinControls.Data.FilterDescriptor).PropertyName = "AcctNbr" Then
Dim CurrentVal As String = CStr(e.NewValue)
dv.RowFilter = "EnAcctNbr <>'" & CurrentVal & "'"
End If
End If
how can I achieve this behavior ? I tried to assign the updated dataview as datasource to the grid in `grd_CellEndEdit` event that too did not work. pls. help.
Regards,
Amit Rai