We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 09:51 AM

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 01:14 PM

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 04:24 PM

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.
Live Chat Icon For mobile
Up arrow icon