Dynamic Filter on a ReadOnly grid - VB.NET

Hi,

I want to use the Dynamic filter to limit the rows.
However the moment I mark the grid as Read Only, the filter row also becomes readonly and I cannot use it.

I've seen the same thread for C# but with been new to coding i can't figure the example out. If you could add whats needed on to my code it would allow me to understand better with been new. 


Imports Syncfusion.Data

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'TESTDataSet.UDEF_STOCK_BY_LOCATION_LEEDS' table. You can move, or remove it, as needed.
        Me.UDEF_STOCK_BY_LOCATION_LEEDSTableAdapter.Fill(Me.TESTDataSet.UDEF_STOCK_BY_LOCATION_LEEDS)
        AddHandler Me.SfDataGrid1.CellDoubleClick, AddressOf SFDataGrid_CellDoubleClick

    End Sub

    Private Sub SFDataGrid_CellDoubleClick(ByVal sender As Object, ByVal e As Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs)

        If e.DataRow IsNot Nothing AndAlso e.DataRow.RowData IsNot Nothing Then
            Dim form = New Form2()
            form.TextBox1.Text = (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(0).ToString()
            form.TextBox2.Text = (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(1).ToString()
            form.TextBox3.Text = (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(2).ToString() & " " & (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(3).ToString()
            form.TextBox4.Text = (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(4).ToString()
            form.TextBox5.Text = (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(7).ToString()
            form.TextBox6.Text = (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(6).ToString()
            form.TextBox7.Text = (TryCast(e.DataRow.RowData, DataRowView)).Row.ItemArray(5).ToString()
            form.ShowDialog()
        End If


    End Sub


End Class

3 Replies

AA Arulraj A Syncfusion Team September 6, 2018 05:49 AM UTC

Hi Paul, 

Thanks for contacting Syncfusion support. 

In SfDataGrid, editing can be controlled only by grid wise or column wise. It doesn’t support to control editing by row wise. But you can achieve your requirement by handling the SfDataGrid.CurrentCellBeginEdit event. Enable the SfDataGrid.AllowEditing property and cancel the editing if the current edited cell is not a Filter row’s cell within the CurrentCellBeginEdit event. Please refer to the following code example and sample from the given location. 

Code Example: 
AddHandler Me.sfDataGrid.CurrentCellBeginEdit, AddressOf sfDataGrid_CurrentCellBeginEdit 
 
Private Sub sfDataGrid_CurrentCellBeginEdit(ByVal sender As Object, ByVal e As Syncfusion.WinForms.DataGrid.Events.CurrentCellBeginEditEventArgs) 
       If e.DataRow.RowType <> RowType.FilterRow Then 
              e.Cancel = True 
       End If 
End Sub 

  

Arulraj A 



PA Paul September 6, 2018 10:28 AM UTC

Thank you very much! Works a treat


AA Arulraj A Syncfusion Team September 7, 2018 05:46 AM UTC

Hi Paul, 

Thanks for the update. 

We are glad to know that the reported problem has been solved at your end. Please let us know if you have any further queries on this. We are happy to help you. 

Regards, 
Arulraj A 


Loader.
Up arrow icon