WrapCellBehavior in multi row record grid Issue

Hi, please try the following in the MultiRowRecord Sample. In MyBase.Load add the following lines Me.gridDataBoundGrid1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow AddHandler Me.gridDataBoundGrid1.Model.QueryCellInfo, AddressOf CustomerGridQueryCellInfo Add the following procedure Private Sub CustomerGridQueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs) If e.ColIndex > 0 And e.RowIndex > 1 Then If (e.ColIndex = 1 Or e.ColIndex = 5) And e.RowIndex Mod 3 = 0 Then e.Style.Enabled = False Exit Sub End If End If End Sub Now try tab in the grid. It is not behaving properly if we have the last or first column blocked. please give me a solution to handle the above kind of scenario. Thanks in advance. Regards, Vamsi.

1 Reply

AD Administrator Syncfusion Team December 20, 2003 04:32 PM UTC

Hi Vamsi, The reason for this behavior is that grid has different row index and column index in the MultiRow mode. When the Multi rows per record check box is checked, you are having a different layout of columns specified by binder.LayoutColumns
 binder.LayoutColumns(New String() {"CustomerID", "CompanyName", "-", "ContactTitle", "ContactName", "-", ".", "Address", "-", "-", "City", "-", "-", ".", "PostalCode", "Country", "-", "Phone", "Fax", "Region"})
So you should have the same logic implemented for this rows and columns too. In the Model.QueryCellInfo, you should have a condition that if checkbox is true, the logic for MultiRows, if not the logic for single row.
Private Sub CustomerGridQueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
        If Not Me.toggleMultiRowCheckBox.Checked Then
            If e.ColIndex > 0 And e.RowIndex > 1 Then
                If (e.ColIndex = 1 Or e.ColIndex = 5) And e.RowIndex Mod 3 = 0 Then
                    e.Style.Enabled = False
                    Exit Sub
                End If
            End If
        Else
      // Extra 2 headers are counted as Rows
            If e.ColIndex > 0 And e.RowIndex > 5 Then
      // The logic for your case
                If (e.RowIndex Mod 9 = 0 Or e.RowIndex Mod 9 = 1) And e.ColIndex = 1 Then
                    e.Style.Enabled = False
               End If
            End If
        End If
    End Sub
Here is the modified VB sample. Regards, Jay N

Loader.
Up arrow icon