How to prevent row header text from being deleted?

I am new to this Grid control. It seems I can highlight a row and hit delete. Then the row header text I just customized will be deleted. How can I prevent this from happenning? User should be able to delete the cell text but not the header text. Thanks.

3 Replies

AD Administrator Syncfusion Team June 4, 2003 01:51 PM UTC

After setting the Header text, also set the cell to be ReadOnly. Me.GridControl1(2, 0).Text = "sample" Me.GridControl1(2, 0).ReadOnly = True


JN Joy Ni June 6, 2003 05:14 PM UTC

I tried this. It still allowed deletion of the header text. > After setting the Header text, also set the cell to be ReadOnly. > > > Me.GridControl1(2, 0).Text = "sample" > Me.GridControl1(2, 0).ReadOnly = True >


AD Administrator Syncfusion Team June 6, 2003 08:24 PM UTC

Setting ReadOnly works in the 1.6 RC1 release which you can download from this link. Read the release notes: http://www.syncfusion.net/squiffler/patches/v1606/readme.htm Download the installation (~59meg): http://www.syncfusion.net/squiffler/patches/v1606/syncfusionessentialsuitesetup.exe In 1.5.2.0, if you want to prevent this you can catch the ClearingCells event, and only clear the non-header cells.
    Private Sub GridControl1_ClearingCells(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridClearingCellsEventArgs) Handles GridControl1.ClearingCells
        If e.RangeList.AnyRangeIntersects(GridRangeInfo.Col(0)) Then
            Dim range, range1 As GridRangeInfo
            For Each range In e.RangeList
                range1 = range.ExpandRange(1, 1, GridControl1.RowCount, GridControl1.ColCount)
                Me.GridControl1.ClearCells(range1, True)
            Next
            e.Handled = True
        End If
    End Sub

Loader.
Up arrow icon